cramforce / splittable

Module bundler with support for code splitting, ES6 & CommonJS modules.
Apache License 2.0
945 stars 34 forks source link

failed to load module #38

Closed brianleroux closed 7 years ago

brianleroux commented 7 years ago

Possibly expected but here's the steps to reproduce.

entry.js

var document = require('bel')
console.log('hi')
node_modules/global/document.js:3: ERROR - Failed to load module "min-document"
var minDoc = require('min-document');
             ^

1 error(s), 0 warning(s)
java.lang.RuntimeException: INTERNAL COMPILER ERROR.
Please report this problem.

Looks like there is a require('global/document') shim thing thats barfing maybe?

cramforce commented 7 years ago

Quick update before I get off the shuttle:

min-document can't be found. Its package root is missing on the flags to closure compiler, so the bug is further up the food chain.

Ah, just found the problem. There appears to be a browser key in package.json that hides the modules during compilation for the web. I will need to somehow fake these modules to make closure compiler happy, because it still sees the require and fails to find the implementation.

cramforce commented 7 years ago

Fixed the problem. Leaving open, because I didn't write any tests for the new functionality.

cramforce commented 7 years ago
npm publish
+ splittable@3.1.0
brianleroux commented 7 years ago

dope thx! seems to work. still experimenting and will report back 👍