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

Bundle of modules requiring JSON files fails #13

Closed
parroit opened this issue Nov 14, 2014 · 7 comments
Closed

Bundle of modules requiring JSON files fails #13

parroit opened this issue Nov 14, 2014 · 7 comments

Comments

@parroit
Copy link
Contributor

parroit commented Nov 14, 2014

I'm trying to make a bundle that use node-ent, which, in turn, require some json files.

It appear pure-cjs doesn't treat them differently from js files, and when it pass content to esprima for parsing, esprima complains.

@RReverser
Copy link
Owner

@parroit Added support for JSON and published to npm.

@parroit
Copy link
Contributor Author

parroit commented Nov 15, 2014

Thank you. Unfortunately node-ent is not usable by pure-cjs, because it depends on punycode built-in module, but this is out of scope for pure-cjs.
In fact I'm using it exactly because browserify tend to insert a lot of builtin modules, making my bundles bigger and bigger

@RReverser
Copy link
Owner

@parroit Can't you install this package so pure-cjs could find it? https://www.npmjs.org/package/punycode
Or is it different one?

@parroit
Copy link
Contributor Author

parroit commented Nov 15, 2014

Yesterday, I did following step to circumvent the problem I found:

  1. changed node-ent sources transforming json files in js modules - fine, JSON problem go away
  2. introduce the exact punycode module you said as a reference of node-ent - failed, pcjs still doesn't handle it
  3. manually rename node_ent/node_modules/punycode to node_ent/node_modules/_punycode, and changed require('punycode') to require('_punycode') - ok, now my bundle is produced correctly
  4. finally switched to use @mathiasbynens he, same interface, less dependencies. It works fine

Anyway, I'll try to reintroduce node-ent using new pcjs new version, to see if step 2) now work as expected. Did you already publish the new version to NPM?

@parroit
Copy link
Contributor Author

parroit commented Nov 15, 2014

What I love of pcjs is that it force me to discover less dependent modules such as he, which produce smaller packages

@parroit
Copy link
Contributor Author

parroit commented Nov 16, 2014

I confirm that npm modules with name equal to node predefined ones get not bundled. I tried with node-url

Meanwhile, I updated gulp module on npm to use last pcjs version

@RReverser
Copy link
Owner

@parroit Please submit this as separate issue.

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