shellscape / webpack-manifest-plugin

webpack plugin for generating asset manifests
MIT License
1.44k stars 185 forks source link

Manifest.json assets file path is prefixed with 'auto' #229

Closed bighoho123 closed 3 years ago

bighoho123 commented 3 years ago

Expected Behavior

{
  "main.js": "main.js"
}

Actual Behavior

{
  "main.js": "automain.js"
}

Additional Information

Not sure whether this is the plugin bug or webpack bug.

Potentially I could workaround by setting plugin option, but this feels hacky

new WebpackManifestPlugin({
      map: f => {
         f.path = f.path.replace(/^auto/,'');
         return f;
       }
    })
bighoho123 commented 3 years ago

In this pull request, the contributor also mentioned this

https://github.com/shellscape/webpack-manifest-plugin/pull/226#issue-516329272

shellscape commented 3 years ago

This is not an issue with this plugin. See https://webpack.js.org/migrate/5/

404 errors pointing to URLs containing auto
Not all ecosystem tooling is ready for the new default automatic publicPath via output.publicPath: "auto"
Use a static output.publicPath: "" instead.
bighoho123 commented 3 years ago

Thanks!

rykener commented 3 years ago

@shellscape what is the recommended way to deal with this then? Should we be using webpack 4 or?

shellscape commented 3 years ago

@shonin read the migration guide I linked to and follow the instructions, or use v4 sure.

m10 commented 1 year ago

Not all ecosystem tooling is ready for the new default automatic publicPath

could you explain why this issue is closed, even though this plugin is still not "ready for the new default automatic publicPath"? The migration guide implies that the tooling should become ready eventually and only presents a workaround until ready. That is how I read it at least. If this plugin chooses not to support this webpack feature, imo it should at least be documented prominently.

Thx for your effort @shellscape!

IMalyugin commented 1 year ago

Totally agree with @m10 here. I believe @shellscape misunderstood the webpack migration guide. It states the "common issues" and their possible fixes. Replacing "auto" with "" is not a solution in global context.

What does that mean for end-user:

The migration guide simply pointed out that most tools are not ready for automatic public, and until they are upgraded to handle the new breaking change, the only viable solution is replacing it with "".

Thus m10 is right, with all due respect to shellscape, it's not a point of using another official suggested value. It's more of a spec incompliance, and as such must either be fixed, or documented implicitly that webpack-manifest-plugin is not going to support official publicPath: "auto" feature. For now library consumers are forced to manually replace "auto" or use much more complicated runtime __webpack_public_path__ rebinding.

danielkurecka commented 8 months ago

Possible workaround to keep the output.publicPath set to "auto" without having the "auto" prefix in the generated file is to utilize the plugin's own option publicPath and set it to an empty string or to a desired value:

new WebpackManifestPlugin({ publicPath: "" });