Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

--bundle-* not working #235

Open
stephanmax opened this issue Oct 21, 2018 · 2 comments
Open

--bundle-* not working #235

stephanmax opened this issue Oct 21, 2018 · 2 comments
Labels

Comments

@stephanmax
Copy link

Hey folks,
I recently put some of my webtask code into its own class and now want to use the CLI's bundle option to pull everything together. I am using one dependency (the twit library for Twitter) and ran into the following issues:

  • Using --bundle yields the error Uncaught error: Request body size exceeds 122880
  • Using --bundle-minify or --bundle-strict leads to successfully deploying the webtask, but then calling it yields Compilation failed: Cannot find module 'twit'

Did you run into something similar? It looks like --bundle includes the twit library, although I read here that the bundler is not supposed to do that, but rather track dependencies as externals. On the other hand, using --bundle-minify/--bundle-strict seems to lose the twit dependency altogether.

I am happy to work on this and file a PR if you could push me into the right direction.

Thanks a million for this piece of software 👍

PS. You can find the full code here: https://github.com/stephanmax/ephemeral-tweets/tree/feature-keybase_tweet_id

@stephanmax stephanmax changed the title --bundle-* not working --bundle-* not working Oct 21, 2018
@NotMyself
Copy link

Hi @stephanmax,

I took a look at your repository and I think I see the issue. Your package.json is located at the root level of your repository, which is standard for node projects. But your webtask code is located in a src folder.

When deploying a webtask using the CLI, it looks for a package.json next to the webtask code for dependency definitions. It will not look anywhere else. Try pulling your code up to the root directory, or adding a package.json to the src directory. This should resolve the deployment issue.

Take a look at this repo for an example.

stephanmax pushed a commit to stephanmax/ephemeral-tweets that referenced this issue Oct 22, 2018
@stephanmax
Copy link
Author

You are a lifesaver, @NotMyself! Thank you very much, that did the trick.

Now I even recall having read somewhere about the "package.json next to webtask code" issue and that tracking for a package.json file up the directory structure has not been considered yet (forgot why).

Do you think we could put some documentation on this somewhere? It seems kind of counter-intuitive (at least to me) that the bundler has problems with a package.json in the root folder and code somewhere else after specifying the entry point in both package.json's main property and wt-cli's arguments.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants