Tries to install relative entry in cwd
insin opened this issue · 3 comments
insin commented
With webpack config below, where app.js
is in process.cwd()
:
entry:
[ 'C:\\Users\\Jonny\\AppData\\Roaming\\npm\\node_modules\\nwb\\node_modules\\eventsource-polyfill\\dist\\browserify-eventsource.js',
'C:\\Users\\Jonny\\AppData\\Roaming\\npm\\node_modules\\nwb\\node_modules\\webpack-hot-middleware\\client.js',
'app.js' ],
Result:
webpack building...
Installing app.js...
npm WARN package.json serve-react@1.0.0 No description
npm WARN package.json serve-react@1.0.0 No repository field.
npm WARN package.json serve-react@1.0.0 No README data
npm ERR! not a package C:\Users\Jonny\tmp\serve-react\app.js
npm ERR! addLocal Could not install C:\Users\Jonny\tmp\serve-react\app.js
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Jonny\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "app.js" "--save"
Works fine if I path.resolve()
the entry so it gets an absolute path instead - I'm going to change my own code to do this right now, but thought this was worth reporting.
ericclemmons commented
@insin Good catch! I don't have a Window machine, so I had no idea :)
I'm not sure which part is trying to install app.js
. If it's ./app.js
, it works fine?
I wonder if I should remove this chunk:
My thinking is:
- If the module is
require.resolve
able, then it exists & shouldn't be installed. - However, modules missing from
package.json
should be. - But this is a problem, because
app.js
would not exist in `package.json, so it'd try to be installed anyway. - Some NPM packages have
.js
or similar in their package name (fewer nowadays), so the extension may not be a valid signature for determining if something's a module or not.
So, should this just be a caveat?
Dunno what to do...
insin commented
I think it should just be a caveat that people should be using relative (or absolute) entry
paths for local files. That's what the Webpack docs do.
ericclemmons commented
True, it's even listed here as relative: