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

[BUG] module.export= in generated SVG file #222

Closed
xstable opened this issue Dec 31, 2020 · 1 comment
Closed

[BUG] module.export= in generated SVG file #222

xstable opened this issue Dec 31, 2020 · 1 comment

Comments

@xstable
Copy link

xstable commented Dec 31, 2020

With jpeg next-optimized-images work very good, but for SVG it doesn't work at all.

I got some data in the image, but it looks like this (I've shorten the svg-sourcecode to give better overview):

<img style="max-width:100%" src="module.exports = &quot;data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0i......SHORTEN THE SVG HERE ...YzeiIvPgo8L3N2Zz4K&quot;" height="50" width="150" class="logo" alt="Logo">

The above img tag was generated with ?include, but it's the same with an external SVG file.

Why this happen?

@xstable
Copy link
Author

xstable commented Dec 31, 2020

Got it, was an missconfiguration of webpack:

webpack (config) {
    config.module.rules.push(
      {
        test: /\.(png|jpg|gif|eot|ttf|woff|woff2)$/,
        use: {
          loader: 'url-loader',
          options: {
            limit: 100000,
            esModule: false,
            name: '[name].[ext]',
          },
        },
      },

There in test I had SVG, which caused the issue

@xstable xstable closed this as completed Dec 31, 2020
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

1 participant