11const path = require ( 'path' )
2- const VueLoaderPlugin = require ( 'vue-loader/lib/plugin ' )
2+ const { VueLoaderPlugin } = require ( 'vue-loader' )
33const HTMLPlugin = require ( 'html-webpack-plugin' )
44const MiniCssExtractPlugin = require ( 'mini-css-extract-plugin' )
5- const CleanCSSPlugin = require ( 'less-plugin-clean-css' )
65const ESLintPlugin = require ( 'eslint-webpack-plugin' )
76
87const vueLoaderConfig = require ( '../vue-loader.config' )
@@ -23,6 +22,7 @@ module.exports = {
2322 } ,
2423 resolve : {
2524 alias : {
25+ '@' : path . join ( __dirname , '../../src' ) ,
2626 '@main' : path . join ( __dirname , '../../src/main' ) ,
2727 '@renderer' : path . join ( __dirname , '../../src/renderer' ) ,
2828 '@lyric' : path . join ( __dirname , '../../src/renderer-lyric' ) ,
@@ -57,11 +57,6 @@ module.exports = {
5757 loader : 'less-loader' ,
5858 options : {
5959 sourceMap : true ,
60- lessOptions : {
61- plugins : [
62- new CleanCSSPlugin ( { advanced : true } ) ,
63- ] ,
64- } ,
6560 } ,
6661 } ) ,
6762 } ,
@@ -81,6 +76,7 @@ module.exports = {
8176 } ,
8277 {
8378 test : / \. ( p n g | j p e ? g | g i f | s v g ) ( \? .* ) ? $ / ,
79+ exclude : path . join ( __dirname , '../../src/renderer/assets/svgs' ) ,
8480 type : 'asset' ,
8581 parser : {
8682 dataUrlCondition : {
@@ -91,6 +87,20 @@ module.exports = {
9187 filename : 'imgs/[name]-[contenthash:8][ext]' ,
9288 } ,
9389 } ,
90+ {
91+ test : / \. s v g $ / ,
92+ include : path . join ( __dirname , '../../src/renderer/assets/svgs' ) ,
93+ use : [
94+ {
95+ loader : 'svg-sprite-loader' ,
96+ options : {
97+ symbolId : 'icon-[name]' ,
98+ } ,
99+ } ,
100+ 'svg-transform-loader' ,
101+ 'svgo-loader' ,
102+ ] ,
103+ } ,
94104 {
95105 test : / \. ( m p 4 | w e b m | o g g | m p 3 | w a v | f l a c | a a c ) ( \? .* ) ? $ / ,
96106 type : 'asset' ,
@@ -126,7 +136,6 @@ module.exports = {
126136 template : path . join ( __dirname , '../../src/renderer-lyric/index.pug' ) ,
127137 isProd : process . env . NODE_ENV == 'production' ,
128138 browser : process . browser ,
129- scriptLoading : 'blocking' ,
130139 __dirname,
131140 } ) ,
132141 new VueLoaderPlugin ( ) ,
0 commit comments