我无法从3rd party包或CDN链接中加载导入的CSS / SCSS样式。样式在本地可以很好地加载,但是当我运行构建webpack -p --mode production
时,整个应用程序都中断了,并且出现了无法分辨的错误。它正在尝试加载使用create-react-app构建的私有组件项目。
Uncaught SyntaxError: Invalid regular expression: /[A-Za-zªµºÀ-ÖØ-öø-ˈ-Ë‘Ë -ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô§Ô±-Õ–Õ™Õ¡-Ö‡×-תװ-×²Ø -يٮٯٱ-Û“Û•Û¥Û¦Û®Û¯Ûº-Û¼Û¿ÜÜ’-ܯÝ-ޥޱߊ-ßªß´ßµßºà €-à •à šà ¤à ¨à¡€-ࡘࢠࢢ-ࢬऄ-हऽà¥à¥˜-ॡॱ-ॷॹ-ॿঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽৎড়à§à§Ÿ-ৡৰৱਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-àªàª-ઑઓ-નપ-રલળવ-હઽà«à« ૡଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽàœààŸ-à¡à±à®ƒà®…-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹà¯à°…-ఌఎ-à°à°’-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-à´à´’-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-à·†à¸-ะาำเ-ๆàºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫàº-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿá-á•áš-áá¡á¥á¦á®-á°áµ-á‚á‚Žá‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŽ€-áŽáŽ -á´á-ᙬᙯ-ᙿáš-áššáš -ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱá€-á‘á -á¬á®-á°áž€-ឳៗៜá -ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜá¥-á¥á¥°-ᥴᦀ-ᦫá§-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳá…-á‹á®ƒ-ᮠᮮᮯᮺ-ᯥᰀ-á°£á±-á±á±š-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-á¿Œá¿-á¿“á¿–-Ίῠ-Ῥῲ-ῴῶ-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-â„ℯ-ℹℼ-â„¿â……-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧâ´â´°-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-ⷞⸯ々〆〱-〵〻〼ã-ã‚–ã‚-ã‚Ÿã‚¡-ヺー-ヿㄅ-ã„ㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿌ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙿ-êš—êš -ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎêž-êž“êž -Ɦꟸ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê ¢ê¡€-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ê¥†ê¥ -ꥼꦄ-ꦲê§ê¨€-ꨨꩀ-ê©‚ê©„-ê©‹ê© -ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ê«ê« -ꫪꫲ-ê«´ê¬-ꬆꬉ-ꬎꬑ-ê¬–ê¬ -ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©ï©°-龎ff-stﬓ-ﬗï¬ï¬Ÿ-ﬨשׁ-זּטּ-לּמּï€ïïƒï„ï†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ï¿—ï¿š-ï¿œ]/: Range out of order in character class
at new RegExp (<anonymous>)
at Object.<anonymous> (parsePhoneNumber.js:23)
at r (bootstrap:63)
at Object.<anonymous> (Leniency.js:246)
at r (bootstrap:63)
at Object.<anonymous> (findNumbers.js:5)
at r (bootstrap:63)
at Module.<anonymous> (index.js:1)
at r (bootstrap:63)
at Object.<anonymous> (main.scss:3)
这是我的webpack配置:
const CopyWebpackPlugin = require("copy-webpack-plugin");
const AssetsPlugin = require("assets-webpack-plugin");
const webpack = require("webpack");
module.exports = {
output: {
path: __dirname + "/dist/",
filename: "index.js",
},
devtool: "source-map",
module: {
rules: [
{
test: /\.(js)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /(\.png|\.svg|\.jpg)$/,
loader: "url-loader"
},
{
test: /\.css$/,
use: [
{ loader: 'style-loader' },
{
loader: "css-loader",
options: {
modules: true,
// sourceMap: true,
// importLoaders: 1
}
}
],
},
{
test: /\.scss$/,
use: [
{ loader: 'style-loader' },
{
loader: "css-loader",
options: {
modules: true,
sourceMap: true,
importLoaders: 1
}
},
{ loader: 'sass-loader' }
]
}
]
},
plugins: [
new CopyWebpackPlugin([
{ context: "src", from: "**/*" }
], {
ignore: ["*.js", "*.scss", "*.css"]
}),
new AssetsPlugin({
filename: "assets.json",
useCompilerPath: true,
keepInMemory: true,
metadata: {
buildDate: Date.now(),
buildVersion: require("./package.json").version,
exclude: [
"flags/"
]
}
}),
new webpack.LoaderOptionsPlugin({
toolboxTheme: 'theme.scss'
})
]
};