@@ -93,8 +93,6 @@ const configure = ({name, vueTarget, libraryTargetModule}) => (env = {}, { mode
93
93
} ,
94
94
95
95
entry : [
96
- 'core-js' ,
97
- 'regenerator-runtime' ,
98
96
Path . resolve ( __dirname , '../src/index.ts' ) ,
99
97
] ,
100
98
@@ -190,15 +188,17 @@ const configure = ({name, vueTarget, libraryTargetModule}) => (env = {}, { mode
190
188
arrows : caniuse . isSupported ( 'arrow-functions' , targetsBrowsers ) ,
191
189
ecma : caniuse . isSupported ( 'es6' , targetsBrowsers ) ? '2015' : '5' , // note ECMAScript 2015 is the sixth edition of the ECMAScript Language Specification standard
192
190
} : { } ,
193
- unsafe : true ,
194
- unsafe_comps : true ,
195
- unsafe_Function : true ,
196
- unsafe_math : true ,
197
- unsafe_symbols : true ,
198
- unsafe_methods : caniuse . isSupported ( 'es6' , targetsBrowsers ) ,
199
- unsafe_proto : true ,
200
- unsafe_regexp : true ,
201
- unsafe_undefined : true ,
191
+
192
+ // beware, unsafe: true is not suitable for this project !
193
+ // unsafe: true,
194
+ // unsafe_comps: true,
195
+ // unsafe_Function: true,
196
+ // unsafe_math: true,
197
+ // unsafe_symbols: true,
198
+ // unsafe_methods: caniuse.isSupported('es6', targetsBrowsers),
199
+ // unsafe_proto: true,
200
+ // unsafe_regexp: true,
201
+ // unsafe_undefined: true,
202
202
} ,
203
203
} ,
204
204
} ) ,
@@ -340,38 +340,45 @@ ${ pkg.name } v${ pkg.version } for vue${ vueTarget }
340
340
module : {
341
341
rules : [
342
342
isProd ? {
343
- test : / \. ( m j s | j s | t s ) $ / ,
343
+ test : / \. ( m j s | j s | c j s | t s ) $ / ,
344
344
exclude : [
345
- / c o r e - j s / , // Babel should not transpile core-js for correct work.
345
+ / c o r e - j s - p u r e / , // Babel should not transpile core-js for correct work.
346
346
/ r e g e n e r a t o r - r u n t i m e / , // transpile not needed
347
347
] ,
348
348
use : {
349
349
loader : 'babel-loader' ,
350
350
options : {
351
351
compact : ! noCompress ,
352
352
sourceMaps : ! noSourceMap ,
353
-
353
+ sourceType : 'unambiguous' , // doc: https://babeljs.io/docs/en/options#sourcetype
354
+ targets : targetsBrowsers ,
354
355
presets : [
355
356
356
357
...! noPresetEnv ? [
357
358
[
358
359
'@babel/preset-env' ,
359
360
{
360
- useBuiltIns : 'entry' , // https://babeljs.io/docs/en/babel-preset-env#usebuiltins
361
- corejs : {
362
- version : 3 ,
363
- proposals : true
364
- } ,
365
- forceAllTransforms : true ,
366
- targets : {
367
- browsers : targetsBrowsers ,
368
- } ,
369
361
}
370
362
]
371
363
] : [ ] ,
372
364
] ,
373
-
374
365
plugins : [
366
+
367
+ ...! noPresetEnv ? [
368
+ [
369
+ "polyfill-corejs3" ,
370
+ {
371
+ "method" : "usage-pure"
372
+ }
373
+ ] ,
374
+ [
375
+ 'babel-plugin-polyfill-regenerator' ,
376
+ {
377
+ "method" : "usage-pure"
378
+ }
379
+ ]
380
+ ] : [ ] ,
381
+
375
382
] ,
376
383
}
377
384
}
0 commit comments