Skip to content
Snippets Groups Projects
Unverified Commit 6c45c503 authored by Camille Villa's avatar Camille Villa Committed by GitHub
Browse files

Update build to support IE11/Edge out of the box (#2909)

Update build to support IE11/Edge out of the box
parents ddd31cb6 2dd32162
No related branches found
No related tags found
No related merge requests found
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
"@babel/plugin-transform-runtime",
"transform-react-remove-prop-types",
["lodash", { "id": [
"lodash",
]}
]],
}
/*
* babel.config.js used to support a UMD built version of Mirador that is
* compatible with IE11 and Edge.
*/
// eslint-disable-next-line func-names
module.exports = function (api) {
const isDevelopmentEnv = api.env('development');
const isProductionEnv = api.env('production');
const isTestEnv = api.env('test');
const presets = [
isTestEnv && [
'@babel/preset-env',
{
modules: 'commonjs',
targets: {
node: 'current',
},
},
'@babel/preset-react',
],
(isProductionEnv || isDevelopmentEnv) && [
'@babel/preset-env',
{
corejs: 3,
exclude: ['transform-typeof-symbol'],
forceAllTransforms: true,
modules: false,
useBuiltIns: 'entry',
},
],
[
'@babel/preset-react',
{
development: isDevelopmentEnv || isTestEnv,
useBuiltIns: true,
},
],
].filter(Boolean);
const plugins = [
'babel-plugin-macros',
'@babel/plugin-transform-destructuring',
[
'@babel/plugin-proposal-class-properties',
{
loose: true,
},
],
[
'@babel/plugin-proposal-object-rest-spread',
{
useBuiltIns: true,
},
],
[
'@babel/plugin-transform-runtime',
{
corejs: false,
helpers: false, // Needed to support IE/Edge
regenerator: true,
},
],
[
'@babel/plugin-transform-regenerator',
{
async: false,
},
],
['transform-react-remove-prop-types',
{
ignoreFilenames: ['node_modules'],
removeImport: true,
},
],
['lodash', {
id: [
'lodash',
],
},
]];
return {
plugins,
presets,
};
};
......@@ -2,7 +2,7 @@
"files": [
{
"path": "dist/mirador.min.js",
"maxSize": "430 KB"
"maxSize": "460 KB"
}
]
}
/**
* Polyfill file used to build Webpack UMD build. These polyfills are needed to
* support both IE and Edge. If you are using Mirador ES imports these will not
* get bundled up.
*/
import 'core-js/stable'; // eslint-disable-line import/no-extraneous-dependencies
import 'url-polyfill/url-polyfill'; // eslint-disable-line import/no-extraneous-dependencies
import 'unfetch/polyfill'; // eslint-disable-line import/no-extraneous-dependencies
......@@ -4,7 +4,7 @@ const TerserPlugin = require('terser-webpack-plugin');
const paths = require('./config/paths');
const babelLoaderConfig = {
include: paths.appSrc, // CRL
include: paths.appPath, // CRL
loader: require.resolve('babel-loader'),
options: {
// Save disk space when time isn't as important
......@@ -14,7 +14,6 @@ const babelLoaderConfig = {
},
test: /\.(js|mjs|jsx)$/,
};
const baseConfig = [
{
entry: './src/index-core.js',
......@@ -31,7 +30,7 @@ const baseConfig = [
},
},
{
entry: './src/index.js',
entry: ['./src/polyfills.js', './src/index.js'],
module: {
rules: [
babelLoaderConfig,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment