Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capnp-ts fails to generate bundle.js correctly with webpack #86

Closed
sezaru opened this issue Nov 24, 2017 · 1 comment
Closed

capnp-ts fails to generate bundle.js correctly with webpack #86

sezaru opened this issue Nov 24, 2017 · 1 comment

Comments

@sezaru
Copy link

sezaru commented Nov 24, 2017

I'm trying to compile capnp-ts with webpack to run it on the browser, I have a very similar code example as the README.md, but if it's needed, I can write it here to help.

The problem when I run the webpack command is that webpack return several warnings like this:

WARNING in ./node_modules/capnp-ts/lib/serialization/arena/arena-allocation-result.js
6:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/capnp-ts/lib/serialization/arena/arena-allocation-result.js
 @ ./node_modules/capnp-ts/lib/serialization/arena/multi-segment-arena.js
 @ ./node_modules/capnp-ts/lib/serialization/arena/index.js
 @ ./node_modules/capnp-ts/lib/serialization/message.js
 @ ./node_modules/capnp-ts/lib/serialization/index.js
 @ ./node_modules/capnp-ts/lib/index.js
 @ ./src/index.tsx

WARNING in ./node_modules/capnp-ts/lib/serialization/pointers/void-list.js
8:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/capnp-ts/lib/serialization/pointers/void-list.js
 @ ./node_modules/capnp-ts/lib/serialization/pointers/index.js
 @ ./node_modules/capnp-ts/lib/serialization/index.js
 @ ./node_modules/capnp-ts/lib/index.js
 @ ./src/index.tsx

WARNING in ./node_modules/capnp-ts/lib/errors.js
8:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/capnp-ts/lib/errors.js
 @ ./node_modules/capnp-ts/lib/types/uint64.js
 @ ./node_modules/capnp-ts/lib/types/index.js
 @ ./node_modules/capnp-ts/lib/index.js
 @ ./src/index.tsx

Webpack does generate a bundle.js in the end, bug when I run it, I got error Error: Cannot find module "." in the firefox webtools console.

So, my question is, how can I generate the webpack bundle.js correctly?

@jdiaz5513
Copy link
Owner

I changed the build to use commonjs format modules, not UMD (what was I thinking?). That should resolve your problem here; try out 0.2.4 and reopen if it's still broken.

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

No branches or pull requests

2 participants