Closed pgilad closed 6 years ago
I'm using the following code to remove publicPath in manifest.json
😊
new ManifestPlugin({
map(asset) {
return Object.assign(asset, {
path: asset.path.replace(output.publicPath, ''),
});
},
})
Thanks, I use this:
// work around publicPath being added to rev-manifest
if (file.path.startsWith(publicPath)) {
file.path = file.path.substr(publicPath.length);
}
But this sucks, I'd rather it not added in the first place
On this one, I'm not sure yet...
I don't think adding publicPath
back would be a bad idea
Can you send a PR to add it back (with tests and appropriate docs update)?
Can you give me more context?
@mastilver I'd just like to use it exactly like this https://github.com/webdeveric/webpack-assets-manifest#add-your-cdn to prefix the values with the CDN host in production.
yes, I think we should add it back...
I think it's annoying enough peoples...
Do you want to send a PR @joaovieira ?
@mastilver cool! I'm a little busy right now, but I'm happy to have a look in a couple of days when I'm a bit more free if no one picked it up before!
(Adding to TODO list) 👍
Would you be able to point the commit where it was removed if not asking too much?
Dough, never mind my use case! I don't need it after all 🤦♂️ What I really need/want is to change the output.publicPath
for all the rewiring, not just the manifest. This is so async chunks/modules (loaded internally by webpack) use that as well. It's working perfectly.
Re: https://webpack.js.org/configuration/output/#output-publicpath
@mastilver - my use case is to read certain files on the server side an inline them into the html document that gets served. I rely on the manifest to know what file to read in, and do not want the publicPath
to be present since the files simply exist within my dist
folder.
@third774 Would you be fine, if you have to use it that way:
new ManifestPlugin({
publicPath: ''
})
We have the same problem as @third774 . Your solution @mastilver would work for us perfectly. For now, we're using @pgilad workaround.
available on v2
Currently
publicPath
is taken from webpackoutput.publicPath
, while this may work, in our use case we don't want to add thepublicPath
. There is currently no way to override it