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

"PUBLIC_URL" no parse #176

Open
qwerchuan opened this issue Sep 7, 2021 · 4 comments
Open

"PUBLIC_URL" no parse #176

qwerchuan opened this issue Sep 7, 2021 · 4 comments

Comments

@qwerchuan
Copy link

URIError: Failed to decode param '/%PUBLIC_URL%/favicon.ico'

@jobh
Copy link

jobh commented Sep 20, 2021

Same problem here (1.5.0). After wrapping webpack config with smp.wrap as described in Usage, %PUBLIC_URL% in index.html is not replaced as it should.

@jobh
Copy link

jobh commented Sep 20, 2021

Current workaround is to make it conditional in build.js,

if (process.env.MEASURE_BUILD) {
  ...wrap...
}

and don't use the measured builds for anything (except measuring of course).

@hellokidder
Copy link

All environment variables are not parsed in template html
is my minimal GitHub repository to show this
https://github.com/hellokidder/webpack-bundle-analyzer-test

@Ricola3D
Copy link

Ricola3D commented Nov 15, 2021

Same issue here with %PUBLIC_URL%.
I'd like to use the SMP wrapper in production to remove the CRA default "IgnorePlugin" for the popular library Method.js that has huge locale files because I don't use it.

Is there any solution to get both of them working ? Maybe removing the 2 plugins before wrap and adding them manually after wrap ?

        shouldInlineRuntimeChunk &&
        new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/runtime-.+[.]js/]),
      // Makes some environment variables available in index.html.
      // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
      // <link rel="icon" href="%PUBLIC_URL%/favicon.ico">
      // It will be an empty string unless you specify "homepage"
      // in `package.json`, in which case it will be the pathname of that URL.
      new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw),```

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

4 participants