You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 18, 2025. It is now read-only.
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.
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.
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.
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:--bundle
yields the errorUncaught error: Request body size exceeds 122880
--bundle-minify
or--bundle-strict
leads to successfully deploying the webtask, but then calling it yieldsCompilation failed: Cannot find module 'twit'
Did you run into something similar? It looks like
--bundle
includes thetwit
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 thetwit
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
The text was updated successfully, but these errors were encountered: