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

Categories

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

image-webpack-loader导致的报错问题

vue-cli3, 新增加了image-webpack-loader, 在vue.config.js中增加以下内容,结果导致报错:

chainWebpack: config => {
    config.module
 .rule('images')
        .test(/.(png|jpe?g|gif|svg|ico)(?.*)?$/)
        .use('image-webpack-loader')
        .loader('image-webpack-loader')
        .options({bypassOnDebug:true})
}

报错:

?  Building for production...

 ERROR  Failed to compile with 1 errors                                                                                                                                    00:28:09

 error  in ./src/App.vue?vue&type=style&index=0&lang=scss&

Syntax Error: ModuleBuildError: Module build failed (from ./node_modules/_image-webpack-loader@7.0.1@image-webpack-loader/index.js):
SyntaxError: Invalid regular expression: /^.*?((?<label>.*?)[,)]/: Invalid group


 @ ./src/App.vue?vue&type=style&index=0&lang=scss& 1:0-480 1:0-480
 @ ./src/App.vue
 @ ./src/main.js
 @ multi ./src/main.js

 ERROR  Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! otary-video-parser-web@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the otary-video-parser-web@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

有没有人遇到这种问题,或者要怎么排查?


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

1 Reply

0 votes
by (71.8m points)

后面改用url-loader,问题解决


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...