I’m moving my app to webpack. I think I got the main config right. The build is failing while importing a npm package and trying to load its package.json
:
Somewhere I have:
import juice from 'juice';
And this package loads its config like var packageJson = require('./package');
Webpack fails to resolve this path with:
Errors prevented startup:
While processing files with webpack:webpack (for target os.osx.x86_64):
src/server.js: ./~/juice/index.js
Module not found: Error: Cannot resolve 'file' or 'directory' ./package in
pathToProject/node_modules/juice
resolve file
pathToProject/node_modules/juice/package doesn't exist
pathToProject/node_modules/juice/package.js doesn't exist
pathToProject/node_modules/juice/package.jsx doesn't exist
pathToProject/node_modules/juice/package.css doesn't exist
pathToProject/node_modules/juice/package.less doesn't exist
resolve directory
pathToProject/node_modules/juice/package doesn't exist (directory default file)
pathToProject/node_modules/juice/package/package.json doesn't exist (directory description
file)
[pathToProject/node_modules/juice/package]
[pathToProject/node_modules/juice/package.js]
[pathToProject/node_modules/juice/package.jsx]
[pathToProject/node_modules/juice/package.css]
[pathToProject/node_modules/juice/package.less]
@ ./~/juice/index.js 15:18-38
It seems that webpack looks at /package/package.json
instead of /package.json
.
Here is how to reproduce the error: https://github.com/gsabran/kickstart-meteor-react-flowrouter/commit/7249fe4a92429b0cff9ef8152559dc323b1f403b