fix: use case insensitive regex for webpack loader rules (#4728)

This commit is contained in:
William Chong 2019-01-10 03:48:34 +08:00 committed by Pooya Parsa
parent f85ac94a87
commit 68d8d54e83

View File

@ -50,7 +50,7 @@ export default class WebpackBaseConfig {
normalizeTranspile() {
// include SFCs in node_modules
const items = [/\.vue\.js/]
const items = [/\.vue\.js/i]
for (const pattern of this.options.build.transpile) {
if (pattern instanceof RegExp) {
items.push(pattern)
@ -188,15 +188,15 @@ export default class WebpackBaseConfig {
return [
{
test: /\.vue$/,
test: /\.vue$/i,
loader: 'vue-loader',
options: this.loaders.vue
},
{
test: /\.pug$/,
test: /\.pug$/i,
oneOf: [
{
resourceQuery: /^\?vue/,
resourceQuery: /^\?vue/i,
use: [{
loader: 'pug-plain-loader',
options: this.loaders.pugPlain
@ -214,7 +214,7 @@ export default class WebpackBaseConfig {
]
},
{
test: /\.jsx?$/,
test: /\.jsx?$/i,
exclude: (file) => {
// not exclude files outside node_modules
if (!/node_modules/.test(file)) {
@ -230,12 +230,12 @@ export default class WebpackBaseConfig {
})
},
{
test: /\.ts$/,
test: /\.ts$/i,
loader: 'ts-loader',
options: this.loaders.ts
},
{
test: /\.tsx$/,
test: /\.tsx$/i,
use: [
{
loader: require.resolve('babel-loader'),
@ -248,43 +248,43 @@ export default class WebpackBaseConfig {
]
},
{
test: /\.css$/,
test: /\.css$/i,
oneOf: styleLoader.apply('css')
},
{
test: /\.p(ost)?css$/,
test: /\.p(ost)?css$/i,
oneOf: styleLoader.apply('postcss')
},
{
test: /\.less$/,
test: /\.less$/i,
oneOf: styleLoader.apply('less', {
loader: 'less-loader',
options: this.loaders.less
})
},
{
test: /\.sass$/,
test: /\.sass$/i,
oneOf: styleLoader.apply('sass', {
loader: 'sass-loader',
options: this.loaders.sass
})
},
{
test: /\.scss$/,
test: /\.scss$/i,
oneOf: styleLoader.apply('scss', {
loader: 'sass-loader',
options: this.loaders.scss
})
},
{
test: /\.styl(us)?$/,
test: /\.styl(us)?$/i,
oneOf: styleLoader.apply('stylus', {
loader: 'stylus-loader',
options: this.loaders.stylus
})
},
{
test: /\.(png|jpe?g|gif|svg|webp)$/,
test: /\.(png|jpe?g|gif|svg|webp)$/i,
use: perfLoader.asset().concat({
loader: 'url-loader',
options: Object.assign(
@ -294,7 +294,7 @@ export default class WebpackBaseConfig {
})
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/i,
use: perfLoader.asset().concat({
loader: 'url-loader',
options: Object.assign(
@ -304,7 +304,7 @@ export default class WebpackBaseConfig {
})
},
{
test: /\.(webm|mp4|ogv)$/,
test: /\.(webm|mp4|ogv)$/i,
use: perfLoader.asset().concat({
loader: 'file-loader',
options: Object.assign(