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

crunch <-> fs #4838

Closed
chris-cooper opened this issue Jan 10, 2017 · 2 comments
Closed

crunch <-> fs #4838

chris-cooper opened this issue Jan 10, 2017 · 2 comments

Comments

@chris-cooper
Copy link
Contributor

There's a webpack build issue in our app when running from the latest 3d-tiles branch...

ModuleNotFoundError: Module not found: Error: Cannot resolve module 'fs' in /path/to/our/app/node_modules/cesium/Source/ThirdParty

I notice this PR contains var nodeFS=require("fs") in crunch.js so is a likely cause of the problem.

@mramato
Copy link
Contributor

mramato commented Jan 10, 2017

Looking at the code, this sounds like a bug in webpack where it is trying to parse and handle those requires even though they are contained inside an if block that does not get executed in the browser. Assuming webpack does not handle dynamic requires, is there at least a way to have them ignored?

Since crunch.js is output from emscripten and I believe is generated to work both in Node and the browser, I'm not sure what a good solution would be here. Have you filed an issue with webpack?

@chris-cooper
Copy link
Contributor Author

One of my colleagues has pointed out that you can add fs as an external in your webpack config to get around this issue...

    externals: {
        'fs': true,
    },

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