File tree 2 files changed +19
-6
lines changed
packages/@vue/babel-preset-app
2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -50,3 +50,7 @@ This is the default Babel preset used in all Vue CLI projects.
50
50
- ** jsx**
51
51
52
52
Default: ` true ` . Set to ` false ` to disable JSX support.
53
+
54
+ - ** loose**
55
+
56
+ Default: ` false ` . Setting this to ` true ` will generate code that is more performant but less spec-compliant.
Original file line number Diff line number Diff line change @@ -14,12 +14,20 @@ module.exports = (context, options = {}) => {
14
14
)
15
15
}
16
16
17
+ const {
18
+ loose = false ,
19
+ useBuiltIns = 'usage' ,
20
+ modules = false ,
21
+ targets,
22
+ decoratorsLegacy
23
+ } = options
24
+
17
25
const envOptions = {
18
- modules : options . modules || false ,
19
- targets : options . targets ,
20
- useBuiltIns : typeof options . useBuiltIns === 'undefined' ? 'usage' : options . useBuiltIns
26
+ loose,
27
+ modules,
28
+ targets,
29
+ useBuiltIns
21
30
}
22
- delete envOptions . jsx
23
31
// target running node version (this is set by unit testing plugins)
24
32
if ( process . env . VUE_CLI_BABEL_TARGET_NODE ) {
25
33
envOptions . targets = { node : 'current' }
@@ -37,8 +45,9 @@ module.exports = (context, options = {}) => {
37
45
// stage 2. This includes some important transforms, e.g. dynamic import
38
46
// and rest object spread.
39
47
presets . push ( [ require ( '@babel/preset-stage-2' ) , {
40
- useBuiltIns : true ,
41
- decoratorsLegacy : options . decoratorsLegacy !== false
48
+ loose,
49
+ useBuiltIns : useBuiltIns !== false ,
50
+ decoratorsLegacy : decoratorsLegacy !== false
42
51
} ] )
43
52
44
53
// transform runtime, but only for helpers
You can’t perform that action at this time.
0 commit comments