Upgrade to latest babel
There has been a lot of renaming and restructuring in babel, so we need to modify our code to handle the latest version. We also need to adjust the way we build our babel worker as babel itself no longer runs in older browsers such as Internet Explorer.
This commit is contained in:
@@ -4,7 +4,7 @@ const path = require('path');
|
||||
const program = require('commander');
|
||||
const fs = require('fs');
|
||||
const fse = require('fs-extra');
|
||||
const babel = require('babel-core');
|
||||
const babel = require('@babel/core');
|
||||
|
||||
const SUPPORTED_FORMATS = new Set(['amd', 'commonjs', 'systemjs', 'umd']);
|
||||
|
||||
@@ -134,8 +134,12 @@ function make_lib_files(import_format, source_maps, with_app_dir, only_legacy) {
|
||||
|
||||
// NB: we need to make a copy of babel_opts, since babel sets some defaults on it
|
||||
const babel_opts = () => ({
|
||||
plugins: [`transform-es2015-modules-${import_format}`],
|
||||
presets: ['es2015'],
|
||||
plugins: [],
|
||||
presets: [
|
||||
[ '@babel/preset-env',
|
||||
{ targets: 'ie >= 11',
|
||||
modules: import_format } ]
|
||||
],
|
||||
ast: false,
|
||||
sourceMaps: source_maps,
|
||||
});
|
||||
|
||||
@@ -33,10 +33,6 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
'commonjs': {
|
||||
optionsOverride: (opts) => {
|
||||
// CommonJS supports properly shifting the default export to work as normal
|
||||
opts.plugins.unshift("add-module-exports");
|
||||
},
|
||||
appWriter: (base_out_path, script_base_path, out_path) => {
|
||||
const browserify = require('browserify');
|
||||
const b = browserify(path.join(script_base_path, 'app/ui.js'), {});
|
||||
@@ -60,9 +56,5 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
'umd': {
|
||||
optionsOverride: (opts) => {
|
||||
// umd supports properly shifting the default export to work as normal
|
||||
opts.plugins.unshift("add-module-exports");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user