gowravshekar / bootstrap-webpack

bootstrap package for webpack
MIT License
136 stars 22 forks source link

Webpack 2 error: Can't resolve './bootstrap-styles' & './bootstrap-scripts' #39

Closed leefsmp closed 7 years ago

leefsmp commented 7 years ago

Is this supposed to be compatible with Webpack 2? I am getting following error when building my app:

ERROR in ./~/bootstrap-webpack/index.js
Module not found: Error: Can't resolve './bootstrap-styles' in '/Users/leefsmp/Desktop/forge-react-template/node_modules/bootstrap-webpack'
 @ ./~/bootstrap-webpack/index.js 1:0-66
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client ./src/client/index.js

ERROR in ./~/bootstrap-webpack/index.js
Module not found: Error: Can't resolve './bootstrap-scripts' in '/Users/leefsmp/Desktop/forge-react-template/node_modules/bootstrap-webpack'
 @ ./~/bootstrap-webpack/index.js 2:0-52
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client ./src/client/index.js

Thanks for any hint how this should be fixed ...

pawanpoudel commented 7 years ago

This pull request fixes this issue and has already been merged into master. Unfortunately, the NPM site still shows 0.0.5 as the latest version which was published about a year ago. Hopefully, a new version will be published soon and this issue will go away. In the meantime, if you go to the node_modules/bootstrap-webpack in your project's root directory and replace the contents of index.js file with the following code, the error should go away.

require("style-loader!css-loader!less-loader!./bootstrap-styles.loader!./bootstrap.config.js");
require("./bootstrap-scripts.loader!./bootstrap.config.js");

The root cause of the issue is that Webpack 2.x no longer allows us to omit the loader suffix when using loaders. The current version (0.0.5) of the bootstrap-webpack package uses bootstrap-scripts and bootstrap-styles instead of the full name of the loader files: bootstrap-scripts.loader and bootstrap-styles.loader in the index.js file. That's why Webpack says it can't find those modules.

leefsmp commented 7 years ago

That was my guess, thanks for the feedback. I hope the package will be updated soon. In the meantime I moved to bootstrap-loader.

wolfadex commented 7 years ago

@leefsmp I've published 0.0.6 to npm, please let me know if there's any issues.

leefsmp commented 7 years ago

Awesome, all good now. Thanks!