bootstrap-webpack
bootstrap-webpack copied to clipboard
Issues with script loading
using require("bootstrap-webpack") in my main.js.
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/bootstrap-webpack/bootstrap.config.js Module build failed: Error: Cannot find module '/Users/me/Projects/portal/node_modules/react-hot-loader/index.js!/Users/me/Projects/portal/node_modules/jsx-loader/index.js?harmony!/Users/me/Projects/portal/node_modules/bootstrap-webpack/bootstrap.config.js' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.module.exports.pitch (/Users/me/Projects/portal/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16) @ ./~/bootstrap-webpack/index.js 4:0-52
Hey hey! I got the same issue.
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/bootstrap-webpack/bootstrap.config.js
Module build failed: Error: Cannot find module '/home/yoihito/Work/learning_new_stuff/whiteboard/node_modules/react-hot-loader/index.js!/home/yoihito/Work/learning_new_stuff/whiteboard/node_modules/jsx-loader/index.js?harmony!/home/yoihito/Work/learning_new_stuff/whiteboard/node_modules/bootstrap-webpack/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.module.exports.pitch (/home/yoihito/Work/learning_new_stuff/whiteboard/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.js 4:0-52
It appears that your webpack config, as a global loaders defined for *.js files.
Using global settings(*.js) to apply loaders will affect bootstrap-webpack. To overcome this, you can use the below options(1/2/combinations)
- Use exclude option of the module.loaders section of the config.
- Adjust the regex in test option of the module loaders to prevent matching all the js files to which the loaders are applied.
To give an example, use .config.js for all your config files and and use the regex /^((?!.config.).).js$/ to prevent parsing of config files in the global test settings. The provided regex doesn't match any files of the pattern *.config.js but matches rest of *.js.
See the explanation of different module options under module.loaders http://webpack.github.io/docs/configuration.html
I've also the same error:
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/bootstrap-webpack/bootstrap.config.js
Module build failed: Error: Cannot find module '/Users/matteo/unshift/repos/locals/playground/react/simple-app/node_modules/babel-loader/index.js?{"modules":"common"}!/Users/matteo/unshift/repos/locals/playground/react/simple-app/node_modules/bootstrap-webpack/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.module.exports.pitch (/Users/matteo/unshift/repos/locals/playground/react/simple-app/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.js 4:0-52
I'm using webpack 1.9.11
and react-bootstrap 0.23.0
thanks @gowravshekar
I had to slightly adjust my regex, below is my working loaders if it helps anyone
module: {
loaders: [
{test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery' },
{test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" },
{test: /^((?!config).)*\.js?$/, exclude: /node_modules/, loader: 'babel?cacheDirectory'}
]
}