Closed deanshub closed 9 years ago
Can you please post your directory structure and the way you are requiring bootstrap-webpack.
Also use webpack -c --display-error-details
. This will provide a verbose error description.
I have same issue...
/srv/template webpack -c --display-error-details
Hash: 9d260b4b83a9893fd081
Version: webpack 1.7.2
ERROR in (undefined) ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-248
Child
Hash: 9d260b4b83a9893fd081
Version: webpack 1.7.2
Time: 958ms
[0] multi main 52 {0} [built]
+ 44 hidden modules
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-248
Paying attention on this line:
'/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
Then ... removed source-map-loader for bootstrap config files like that (loader config):
{test: /\.js$/, exclude: /(node_modules)|(bootstrap.config)/, loader: "source-map"}
BTW I have no clue why it helped ...
I should notice that babel-loader also breaks build:
/srv/template webpack -c --display-error-details
Hash: 8f6333fd17046d642014
Version: webpack 1.7.2
ERROR in (undefined) ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/babel-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/babel-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-243
Child
Hash: 8f6333fd17046d642014
Version: webpack 1.7.2
Time: 970ms
[0] multi main 52 {0} [built]
+ 44 hidden modules
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/babel-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/babel-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-243
If I exclude babel-loader for bootstrap.config, it builds...
@ColCh,
'/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
It appears to be that the same loader is mentioned twice.
Please try these three options to analyse or pinpoint the cause.
js
require('bootstrap-webpack!relative_path_to_bootstrap.config.js');
require('bootstrap-webpack!source-map-loader!relative_path_to_bootstrap.config.js');
Let us know the result.
require('bootstrap-webpack!relative_path_to_bootstrap.config.js');
:
user@c9ebdee9bdb6:/srv/template$ webpack
Hash: 5b85d768c400e7f98032
Version: webpack 1.7.2
ERROR in (undefined) ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/babel-loader!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/babel-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-222
Child
Hash: 5b85d768c400e7f98032
Version: webpack 1.7.2
Time: 3110ms
[0] multi main 40 {0} [built]
+ 90 hidden modules
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/babel-loader!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/babel-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-222
Child extract-text-webpack-plugin:
+ 7 hidden modules
Child extract-text-webpack-plugin:
+ 74 hidden modules
require('source-map-loader!relative_path_to_bootstrap.config.js');
: http://pastebin.com/0DU6JPja
require('bootstrap-webpack!source-map-loader!relative_path_to_bootstrap.config.js');
:
user@c9ebdee9bdb6:/srv/template$ webpack
Hash: e00101b8213dffc11301
Version: webpack 1.7.2
ERROR in (undefined) ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/source-map-loader!./~/babel-loader!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/babel-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./~/source-map-loader!./bootstrap.config.js 2:0-276
Child
Hash: e00101b8213dffc11301
Version: webpack 1.7.2
Time: 3101ms
[0] multi main 40 {0} [built]
+ 90 hidden modules
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/source-map-loader!./~/babel-loader!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/babel-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./~/source-map-loader!./bootstrap.config.js 2:0-276
Child extract-text-webpack-plugin:
+ 7 hidden modules
Child extract-text-webpack-plugin:
+ 74 hidden modules
Also, with other loaders removed:
require('bootstrap-webpack!../bootstrap.config.js');
:
user@c9ebdee9bdb6:/srv/template$ webpack
Hash: df6e9cc941cd9da02224
Version: webpack 1.7.2
Child
Hash: df6e9cc941cd9da02224
Version: webpack 1.7.2
Time: 3789ms
Asset Size Chunks Chunk Names
f4769f9bdb7466be65088239c12046d1.eot 20127 [emitted]
448c34a56d699c29117adc64c43affeb.woff2 18028 [emitted]
fa2772327f55d8198301fdb8bcfc8158.woff 23424 [emitted]
e18bbf611f2a2e43afc071aa2f4e1512.ttf 45404 [emitted]
89889688147bd7575d6327160d64e760.svg 108738 [emitted]
main.js 357469 0 [emitted] main
main.css 165129 0 [emitted] main
main.js.map 433449 0 [emitted] main
main.css.map 85 0 [emitted] main
[0] multi main 40 {0} [built]
+ 104 hidden modules
Child extract-text-webpack-plugin:
+ 7 hidden modules
Child extract-text-webpack-plugin:
+ 74 hidden modules
require('source-map-loader!relative_path_to_bootstrap.config.js');
: http://pastebin.com/72XWuKzR
require('bootstrap-webpack!source-map-loader!relative_path_to_bootstrap.config.js');
:
user@c9ebdee9bdb6:/srv/template$ webpack
Hash: a35ec6fcc70ee9618f28
Version: webpack 1.7.2
ERROR in (undefined) ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./~/source-map-loader!./bootstrap.config.js 2:0-173
Child
Hash: a35ec6fcc70ee9618f28
Version: webpack 1.7.2
Time: 3053ms
[0] multi main 40 {0} [built]
+ 90 hidden modules
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/source-map-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/source-map-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./~/source-map-loader!./bootstrap.config.js 2:0-173
Child extract-text-webpack-plugin:
+ 7 hidden modules
Child extract-text-webpack-plugin:
+ 74 hidden modules
Also, with babel-loader turned on:
user@c9ebdee9bdb6:/srv/template$ webpack
Hash: 76945b48f10eaf3c8d2b
Version: webpack 1.7.2
ERROR in (undefined) ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/babel-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/babel-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-168
Child
Hash: 76945b48f10eaf3c8d2b
Version: webpack 1.7.2
Time: 3219ms
[0] multi main 40 {0} [built]
+ 90 hidden modules
ERROR in ./~/bootstrap-webpack/bootstrap-scripts.loader.js!./~/babel-loader!./bootstrap.config.js
Module build failed: Error: Cannot find module '/srv/template/node_modules/babel-loader/index.js!/srv/template/bootstrap.config.js'
at Function.Module._resolveFilename (module.js:320:15)
at Function.Module._load (module.js:262:25)
at Module.require (module.js:349:17)
at require (module.js:368:17)
at Object.module.exports.pitch (/srv/template/node_modules/bootstrap-webpack/bootstrap-scripts.loader.js:20:16)
@ ./~/bootstrap-webpack/index.loader.js!./bootstrap.config.js 2:0-168
Child extract-text-webpack-plugin:
+ 7 hidden modules
Child extract-text-webpack-plugin:
+ 74 hidden modules
Quite interesting, isn't it?
source-map-loader --> extracts inlined source map and offers it to webpack. babel loader --> Turn ES6 code into vanilla ES5 with no runtime required using babel.
But, bootstrap javascript code is written ES5 without inline source maps. Also, the config file used is understood only by bootstrap-webpack loader and not others. I'm not sure why are you(@ColCh) using other loaders to load bootstrap js files.
@deanshub, Any updates ?
@gowravshekar that loader list appends automatically because they are "global" ... It's needed to add bootstrap.config to every loader exclude option
@ColCh, Yes using global settings(*.js) to apply loaders will affect bootstrap-webpack.
To overcome this, you can use the below options(1/2/combinations)
exclude
option of the module.loaders section of the config.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
May be add that to README ? Looks not so obvious
I'm trying to use the default configuration, but i'm getting this weird error Error: Cannot find module 'client/node_modules/bootstrap-webpack/index.loader.js' the file exists there, do you have any suggestions?