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

Building with xlsx npm module fails #3

Open
jussiarpalahti opened this issue Nov 24, 2016 · 2 comments
Open

Building with xlsx npm module fails #3

jussiarpalahti opened this issue Nov 24, 2016 · 2 comments

Comments

@jussiarpalahti
Copy link

I run into this yesterday:

> cbuild -d -v -m systemjs-hot-reloader -o dist/bundle.js -C config-npm.js

Bundling for development (NODE_ENV = undefined and --debug set)

Build error:
Error on fetch for fs.js at file:///Users/jta/tmp/hierarchicaltable-example-app/fs.js
	Loading node_modules/xlsx/xlsx.js
	Loading node_modules/makeMaps/dist/ui_components/import_wizard/FileUploadView.js
	Loading node_modules/makeMaps/dist/ui_components/import_wizard/LayerImportWizard.js
	Loading node_modules/makeMaps/dist/MakeMaps.js
	Loading dist/index.js
	Error: ENOENT: no such file or directory, open '/Users/jta/tmp/hierarchicaltable-example-app/fs.js'
    at Error (native)

I believe the module https://github.com/SheetJS/js-xlsx is the culprit. It would seem cbuild doesn't see node's internal modules correctly and tries to find them in the project folders?

I can make a complete test case later if you wish, but wanted to report this already...

@jjrv
Copy link
Member

jjrv commented Nov 24, 2016

cbuild could probably map that to an empty module or browserify's Node.js library implementations, but shipping a whole filesystem emulation for browser use goes a bit against cbuild philosophy of reducing bloat. Is there a way to remove the fs dependency or would an empty module work in its place?

@jussiarpalahti
Copy link
Author

It's a dependency of a dependency so removal is not possible. I believe it's related to file generation functionality (it makes an excel file inside the browser) and probably uses features from fs for this.

I can try the empty module trick. I'm not entirely sure if the dependency is actually relevant and what happens then. Also, there's a possibility of using bundled version of these dependencies. I can't figure out how those should be declared to cbuild.

Is this more SystemJS' feature than cbuild? I'd like to declare these modules so that they could be found when required, even if they produce bloat.

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