Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when filename contains [hash], [chunkhash] or [contenthash] #5

Closed
nilzona opened this issue Feb 10, 2021 · 6 comments
Closed

Comments

@nilzona
Copy link
Contributor

nilzona commented Feb 10, 2021

if the webpack config is the following:

module.exports = {
  plugins: [
    new MiniCssExtractPlugin({
      filename: "[name].[contenthash].css",
    }),
    new ExposeRuntimeCssAssetsPlugin({
      // The filename here must match the filename for the MiniCssExtractPlugin
      filename: "[name].[contenthash].css",
    }),
  ],
};

the webpacked code tries to request a file where it seems [contenthash] has resolved to undefined

@joeldenning
Copy link
Member

Thanks for reporting this issue, could you clarify which function is accessed that doesn't exist? Full stacktrace would be helpful.

@nilzona
Copy link
Contributor Author

nilzona commented Feb 10, 2021

@joeldenning yes, of course
My description was a bit wrong, if [contenthash] or [chunkhash] is used in the filename like the example above the request resolves to thename.undefined.css
Screenshot 2021-02-10 at 20 46 56

I put together a sample repo here https://github.com/nilzona/sspa-react that could be used to reproduce the issue

@joeldenning
Copy link
Member

Thanks for providing the demonstration repo, I've put together a fix in #6 and released it in https://github.com/single-spa/single-spa-css/releases/tag/v1.1.2

@PieterBoeren
Copy link

PieterBoeren commented Aug 20, 2021

Is this actually fixed?

In my compiled code I see:

d.miniCssF = function(t) {
return "main.af8b913bd3008a4bad58.css"
   }, d.cssAssetFileName = function(t) {
  return (179 === t ? "main" : t) + "." + {
  179: "af8b913bd3008a4bad58"
   } [t] + ".css"

I use the same config as nilzona above.

But the developer tools of the browsers shows me (main.undefined.css):

image

@joeldenning
Copy link
Member

If there's still a bug, please open a new issue with a demonstration.

@PieterBoeren
Copy link

Created #11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants