webpack-concat-plugin icon indicating copy to clipboard operation
webpack-concat-plugin copied to clipboard

Generate Source Map with sourcesContent

Open ChrisMio opened this issue 6 years ago • 1 comments

Hi, in my case the sources of the concated files are outside the webroot. this causes that i can not follow the source file along in chrome when debugging. So afaik for this case, the source maps support the sourcesContent option (i found this https://stackoverflow.com/a/19803425)

currently i have

devtool: 'source-map'

and

new ConcatPlugin({ uglify: false, sourceMap: true, ...

Can someone please give me a hint / what to do? I am not shure how webpack-concat-plugin handles source map, so is it influences by devtools setting for other webpack source map plugins?

ChrisMio avatar Apr 24 '18 10:04 ChrisMio

I want the bundle.js and bundle.map to end up in /Scripts/app

My setup looks like this

new ConcatPlugin({
	uglify: true,
	sourceMap: true,
        outputPath: './',
	fileName: 'bundle.js',
	filesToConcat: [
		'block-ui/jquery.blockUI.js',
		'./Scripts/myCustomScript.js'
	],
	attributes: {
		async: false
	}
});

The result

I get the files correctly in /Scripts/app and the reason for this is because I have the following in my module exports

output: {
		path: path.join(__dirname, 'Scripts', 'app'),
		filename: '[name].bundle.min.js',
	},

However my bundle.js.map contains the following {"version":3,"sources":["\\node_modules\\block-ui\\jquery.blockUI.js", "\\Scripts\\myCustomScript.js" ...

So when I load a page in chrome it tries to load the original js files like so http://localhost:55555/Scripts/app//node_modules/block-ui/jquery.blockUI.js and http://localhost:55555/Scripts/app//Scripts/myCustomScript.js

Where it of course should have been http://localhost:55555/node_modules/block-ui/jquery.blockUI.js and http://localhost:55555/Scripts/myCustomScript.js

I am unsure how to get it cooperate

rickardliljeberg avatar Aug 06 '18 13:08 rickardliljeberg