Closed neutraali closed 2 years ago
Hmm, I can't recall whether I've tried using the glob
options together with the sourcePath
option. A quick review of the code implies that you can specify sourcePath with glob, but then all found files will get the same sourcePath.
Can you provide some more explanation of what it is you are trying to accomplish?
Also, if you think something is not working as it should, it would be really helpful if you could add a test case similar to the ones here:
Right, so... Consider a folder called path/to/build/js
with the following content:
app.bundle.296af3076e0ed3bfc6de.js
app.bundle.296af3076e0ed3bfc6de.js.map
language.bundle.71a7752cee0fd892f808.js
language.bundle.71a7752cee0fd892f808.js.map
vendor.bundle.71a7752cee0fd892f808.js
vendor.bundle.71a7752cee0fd892f808.js.map
... Using the config above, the idea would be to map/link vendor
and language
to their relevant (non-map) source files. This may or may not be an actually relevant issue, as it can probably also be handled by including it in watch
-configuration of Webpack separately.
It looks like you're maybe trying to use this plugin to do things with webpack generated assets, and that's not what this plugin is designed for.
That said, if you're trying to somehow inject existing scripts as tags into your html, you'll need to make sure you copy the scripts and associated source map files using copy-webpack-plugin, so that they get served together from the same place.
usually your JS files will have a comment at the end with a path to the source map, something like this:
//# sourceMappingURL=app.bundle.296af3076e0ed3bfc6de.js.map
So long as the source map path is relative like this and you copy both the script and sourcemap to the same place, your sourcemaps should load properly.
Cool, I can get on with this. Thanks for the snappy replies @jharris4!
Problem:
sourcePath
is incompatible withglob
+globPath
, which leads to builds and/or the DevServer not reacting to any changes. For example, using the following config:... Leads to the following error:
... Which leads me to suspect
sourcePath
is meant for individual files, not directories or anythingglob
-related. Should there be aglobSource
or similar config entry available?