File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
packages/@vue/babel-preset-app Expand file tree Collapse file tree 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.
5050- ** jsx**
5151
5252 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 = {}) => {
1414 )
1515 }
1616
17+ const {
18+ loose = false ,
19+ useBuiltIns = 'usage' ,
20+ modules = false ,
21+ targets,
22+ decoratorsLegacy
23+ } = options
24+
1725 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
2130 }
22- delete envOptions . jsx
2331 // target running node version (this is set by unit testing plugins)
2432 if ( process . env . VUE_CLI_BABEL_TARGET_NODE ) {
2533 envOptions . targets = { node : 'current' }
@@ -37,8 +45,9 @@ module.exports = (context, options = {}) => {
3745 // stage 2. This includes some important transforms, e.g. dynamic import
3846 // and rest object spread.
3947 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
4251 } ] )
4352
4453 // transform runtime, but only for helpers
You can’t perform that action at this time.
0 commit comments