interpolate-html-plugin icon indicating copy to clipboard operation
interpolate-html-plugin copied to clipboard

URIError: Failed to decode param '/%PUBLIC_URL%/favicon-32x32.png'

Open Drafter500 opened this issue 6 years ago • 6 comments

Hi, I updated webpack to v4, and now having this error:

URIError: Failed to decode param '/%PUBLIC_URL%/favicon-32x32.png'

In my index html I have:

<link rel="icon" type="image/png" sizes="32x32" href="%PUBLIC_URL%/favicon-32x32.png">

I've seen that now the order matters and declared the plugin after HtmlWebpackPlugin

  plugins: [
    new HtmlWebpackPlugin({
      inject: true,
      template: paths.appHtml
    }),
    new InterpolateHtmlPlugin({
      PUBLIC_URL: ''
    }),
...

What else am I missing?

Drafter500 avatar May 14 '18 16:05 Drafter500

I'm facing the same issue, and I'm a bit stuck. Any hint on how to solve this ? I'm trying to use it in images like so: index.html <img src="assets/%lang%/image.png"> webpack.config.js (extract)

new HtmlWebPackPlugin({
        template: "./src/index.html",
        filename: index.html,
      }),

...

new InterpolateHtmlPlugin({
        'LANG': 'en'
      })

Output: Module not found: Error: Can't resolve './assets/%lang%/image.png'

jice-lavocat avatar May 31 '18 05:05 jice-lavocat

@tanzaho Did you try to make 'LANG' in lower case so that it matches exactly with the template?

Drafter500 avatar May 31 '18 07:05 Drafter500

I'm having the same issue, any luck?

gregl83 avatar Jan 24 '19 15:01 gregl83

Well, it seems that you just have to make sure that the names of folders in your app do not contain spaces...

Mindo21 avatar Jan 27 '19 23:01 Mindo21

And it worked for me! Just make sure that you do not use spaces in the workspace folders.

Mindo21 avatar Jan 27 '19 23:01 Mindo21

I gave up on trying to use this package directly and used the version supplied by create-react-app, which is in react-dev-utils/InterpolateHtmlPlugin. You can examine how create-react-app uses it by running npm run eject.

MagnusBrzenk avatar Jun 11 '19 21:06 MagnusBrzenk