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

Do not working wds without svg #135

Closed
wakenby opened this issue Dec 6, 2020 · 5 comments
Closed

Do not working wds without svg #135

wakenby opened this issue Dec 6, 2020 · 5 comments
Assignees
Labels

Comments

@wakenby
Copy link

wakenby commented Dec 6, 2020

If you run wds with an empty icon folder and then add icons, then the svg-spritemap-webpack-plugin will not work.

But if you run wds with any icon, then adding new svg-spritemap-webpack-plugin will work fine.

config:

const SvgSpriteMapWebpackPlugin = require('svg-spritemap-webpack-plugin')
const cwd = require('../cwd')

module.exports = [
  new SvgSpriteMapWebpackPlugin(cwd('src/static/icons/*.svg'),
    {
      output: {
        filename: 'assets/sprite/sprite.svg',
        svgo: true
      },
      sprite: {
        prefix: false,
        generate: {
          title: false
        }
      }
    }
  )
]
const { merge } = require('webpack-merge')
const dev = require('./webpack.dev')
const cwd = require('./slices/cwd')

module.exports = merge(dev, {
  devServer: {
    injectClient: true,
    contentBase: cwd('dist'),
    watchContentBase: true,
    port: 8080,
    open: true,
    overlay: {
      warnings: true,
      errors: true
    }
  }
})
@cascornelissen
Copy link
Owner

That was quite the edge case but I'm pretty sure the fix in b5c1071 solves this really well. Can you try out the changes and report back?

You can install these recent changes directly from GitHub using the following command.

npm install cascornelissen/svg-spritemap-webpack-plugin#master

Let me know if it solves the issue on your side ✌🏼

@wakenby
Copy link
Author

wakenby commented Dec 9, 2020

Works!!!

But if there are no icons, then an empty sprite.svg is still created((

@cascornelissen
Copy link
Owner

@wakenby, good point, didn't notice that. The changes in c009e6e should fix this. Could you test it out once more by installing it directly from master?

@wakenby
Copy link
Author

wakenby commented Dec 9, 2020

Perfect work!!!

@wakenby wakenby closed this as completed Dec 9, 2020
@cascornelissen
Copy link
Owner

These changes were included in 3.8.0, thanks once more for reporting the issue! 🚀

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

No branches or pull requests

2 participants