File tree 2 files changed +28
-1
lines changed
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -138,8 +138,15 @@ function cloneRule (rule, normalizedRule) {
138
138
return res
139
139
}
140
140
141
+ // Some loaders like babel-loader passes its own option directly to babel
142
+ // and since babel validates the options, "ident" would cause an unknown option
143
+ // error. For these loaders we'll bail out on the ident reuse.
144
+ const reuseIdentBlackList = / b a b e l - l o a d e r /
145
+
146
+ // Reuse options ident, so that imports from within css-loader would get the
147
+ // exact same request prefixes, avoiding duplicated modules (#1199)
141
148
function reuseIdent ( use ) {
142
- if ( use . ident ) {
149
+ if ( use . ident && ! reuseIdentBlackList . test ( use . loader ) ) {
143
150
use . options . ident = use . ident
144
151
delete use . ident
145
152
}
Original file line number Diff line number Diff line change @@ -56,3 +56,23 @@ test('test-less oneOf rules', done => {
56
56
}
57
57
} , res => assertComponent ( res , done ) )
58
58
} )
59
+
60
+ test ( 'babel-loader inline options' , done => {
61
+ mockBundleAndRun ( {
62
+ entry : 'basic.vue' ,
63
+ module : {
64
+ rules : [
65
+ {
66
+ test : / \. j s / ,
67
+ loader : 'babel-loader' ,
68
+ options : {
69
+ babelrc : false ,
70
+ presets : [
71
+ [ require ( 'babel-preset-env' ) , { modules : false } ]
72
+ ]
73
+ }
74
+ }
75
+ ]
76
+ }
77
+ } , res => assertComponent ( res , done ) )
78
+ } )
You can’t perform that action at this time.
0 commit comments