Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
520 views
in Technique[技术] by (71.8m points)

【已解决】vue使用require加载的svg怎样打包到imgs/目录下

vue-cli4

require加载的svg css背景图

下面这个设置没用。svg还是在dist/根目录下

assetsDir: "img/",

【已解决】
用vue inspect看了下用的file-loader,修改一下好了。

        const fileRule = config.module.rule('file')
        fileRule.uses.clear()
        fileRule
            .test(/.svg$/)
            .exclude.add(path.resolve(__dirname, './src/icons'))
            .end()
            .use('file-loader')
            .loader('file-loader')
            .options({
                outputPath: 'svg/'
            })

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.6k users

...