webpack-contrib/install-webpack-plugin

Intermittent failure to resolve module after installation

insin opened this issue · 2 comments

insin commented

The only reliable repro I can get is that this happens every single time I attempt to document nwb's --[auto-]install option with some example output:

λ preact run Lightbulb.js --install
Starting Webpack compilation...
Compiled successfully in 4153 ms.

The app is running at http://localhost:3000/
Recompiling...
Installing bootstrap...
Failed to compile with 1 error.

 ERROR  in ./Lightbulb.js
Module not found: Error: Cannot resolve module 'bootstrap/dist/css/bootstrap.css' in C:\Users\Jonny\tmp\preact-play
 @ ./Lightbulb.js 6:0-43

λ preact run Lightbulb.js --install
Starting Webpack compilation...
Compiled successfully in 17268 ms.

The app is running at http://localhost:3000/
insin commented

Running example/webpack1 I'm seeing:

ERROR in ./~/css-loader?{"localIdentName":"[name]-[local]--[hash:base64:5]"}!./lib/App/App.css
Module not found: Error: Cannot resolve module 'bootswatch/lumen/bootstrap.css' in C:\Users\Jonny\repos\npm-install-webpack-plugin\example\webpack1\lib\App
 @ ./~/css-loader?{"localIdentName":"[name]-[local]--[hash:base64:5]"}!./lib/App/App.css 3:10-151

Just a coincedence that it's CSS each time?

insin commented

Here's css-loader again running example/webpack2 while testing some other changes - it succeeds in the end because if you open the app, it's styled. Is there some special handling needed?

webpack building...
Installing bootswatch...
webpack built 490a4d3bdc1dbf9c309d in 153997ms
Hash: 490a4d3bdc1dbf9c309d
Version: webpack 2.2.0
Time: 153997ms
             Asset     Size  Chunks                    Chunk Names
0.490a4-c83f22a.js  1.02 kB       0  [emitted]
         client.js   389 kB       1  [emitted]  [big]  client
chunk    {0} 0.490a4-c83f22a.js 231 bytes {1} [rendered]
  [187] ./~/babel-loader/lib?{"cacheDirectory":true}!./src/render.js 231 bytes {0} [built]
chunk    {1} client.js (client) 341 kB [entry] [rendered]
   [26] (webpack)/buildin/module.js 517 bytes {1} [built]
   [53] ./src/client.js 231 bytes {1} [built]
   [54] (webpack)-hot-middleware/client.js?reload=true 5.07 kB {1} [built]
   [57] ./lib/App/index.js 4.9 kB {1} [built]
   [58] ./~/bundle-loader?lazy!./src/render.js 180 bytes {1} [built]
   [62] ./~/html-entities/index.js 231 bytes {1} [built]
   [65] ./~/lodash.capitalize/index.js 8.68 kB {1} [built]
  [166] ./~/querystring-es3/encode.js 2.54 kB {1} [built]
  [167] ./~/querystring-es3/index.js 127 bytes {1} [built]
  [174] ./~/react-transform-catch-errors/lib/index.js 2.68 kB {1} [built]
  [176] ./~/redbox-react/lib/index.js 12.1 kB {1} [built]
  [180] ./~/strip-ansi/index.js 161 bytes {1} [built]
  [183] (webpack)-hot-middleware/client-overlay.js 1.74 kB {1} [built]
  [184] (webpack)-hot-middleware/process-update.js 3.88 kB {1} [built]
  [186] multi webpack-hot-middleware/client?reload=true ./src/client.js 40 bytes {1} [built]
     + 172 hidden modules

ERROR in ./~/css-loader?{"localIdentName":"[name]-[local]--[hash:base64:5]"}!./lib/App/App.css
Module not found: Error: Can't resolve 'bootswatch/lumen/bootstrap.css' in 'C:\Users\Jonny\repos\npm-install-webpack-plugin\example\webpack2\lib\App'
 @ ./~/css-loader?{"localIdentName":"[name]-[local]--[hash:base64:5]"}!./lib/App/App.css 3:10-151
 @ ./lib/App/App.css
 @ ./lib/App/index.js
 @ ./src/client.js
 @ multi webpack-hot-middleware/client?reload=true ./src/client.js
Installing file-loader...
Installing url-loader...
webpack building...
webpack built 030910a3728fe5e2dbc0 in 79742ms