You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package.json can declare a key "main" with a value that's a reference to a file in the package (npm docs). However Google Closure Compiler seems to ignore that value and always look for a file "index.js" as the default. So when a file using that package declares a dependency using require, GCC throws an error.
When the end user runs GCC (ensuring they've supplied the xtend package using the --js flag to the command) they will get this error: my-project.js:1: ERROR - Failed to load module "xtend" var xtend = require('xtend'); ^ 1 error(s)
This is sort of related to #3149 (Packages with dir as "main" in package.json do not resolve.) but I'm filing it anyway just in case the solution for that bug doesn't address this.
I've patched xtend here to fix material-components-web compilation via GCC for my project (I pull in my fork via my package.json).
The text was updated successfully, but these errors were encountered:
@jmosney Did you supply the package.json file to the compilation? You need to pass --js node_modules/immutable/package.json along with your other source files.
package.json can declare a key "main" with a value that's a reference to a file in the package (npm docs). However Google Closure Compiler seems to ignore that value and always look for a file "index.js" as the default. So when a file using that package declares a dependency using require, GCC throws an error.
Example
End user's project
index.js
const xtend = require('xtend');
package.json
{ "dependencies": { "xtend": "4.0.0" } }
npm project
immutable.js
... useful utility...
package.json
{ "main": "immutable" }
When the end user runs GCC (ensuring they've supplied the xtend package using the --js flag to the command) they will get this error:
my-project.js:1: ERROR - Failed to load module "xtend" var xtend = require('xtend'); ^ 1 error(s)
This is sort of related to #3149 (Packages with dir as "main" in package.json do not resolve.) but I'm filing it anyway just in case the solution for that bug doesn't address this.
I've patched xtend here to fix material-components-web compilation via GCC for my project (I pull in my fork via my package.json).
The text was updated successfully, but these errors were encountered: