UNPKG

1.57 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('path')) :
3 typeof define === 'function' && define.amd ? define(['path'], factory) :
4 (global.index = factory(global.path));
5}(this, (function (path) { 'use strict';
6
7path = 'default' in path ? path['default'] : path;
8
9var index = function (context, ref) {
10 if ( ref === void 0 ) ref = {};
11 var useBuiltIns = ref.useBuiltIns;
12
13 var env = process.env.BABEL_ENV || process.env.NODE_ENV;
14
15 var presets = [
16 env === 'test' ?
17 [require('babel-preset-env').default, {
18 targets: {
19 node: 'current'
20 }
21 }] :
22 [require('babel-preset-env').default, {
23 useBuiltIns: useBuiltIns,
24 modules: false,
25 targets: {
26 ie: 9,
27 uglify: true
28 }
29 }],
30 // vue jsx
31 require.resolve('babel-preset-vue')
32 ];
33
34 var plugins = [
35 // Polyfills the runtime needed for async/await and generators
36 [require.resolve('babel-plugin-transform-runtime'), {
37 helpers: !useBuiltIns,
38 polyfill: !useBuiltIns,
39 regenerator: true,
40 // Resolve the Babel runtime relative to the config.
41 moduleName: path.dirname(require.resolve('babel-runtime/package'))
42 }],
43 [require('babel-plugin-transform-object-rest-spread'), {
44 useBuiltIns: useBuiltIns
45 }],
46 // For dynamic import that you will use a lot in code-split
47 require.resolve('babel-plugin-syntax-dynamic-import')
48 ];
49
50 return {
51 presets: presets,
52 plugins: plugins
53 }
54};
55
56return index;
57
58})));