Babel: Refactoring config so that it's shared and removes legacy plugin (#32559)

* Updated plugins

* Fixing stuff

* Update

* Fixing more stuff
This commit is contained in:
Torkel Ödegaard
2021-03-31 19:09:19 +02:00
committed by GitHub
parent d42bfedd9e
commit b0ffcfd558
7 changed files with 125 additions and 195 deletions

View File

@ -8,6 +8,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const getBabelConfig = require('./babel.config');
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = (env = {}) =>
@ -35,43 +36,7 @@ module.exports = (env = {}) =>
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
babelrc: false,
// Note: order is top-to-bottom and/or left-to-right
plugins: [
[
require('@rtsao/plugin-proposal-class-properties'),
{
loose: true,
},
],
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining',
'angularjs-annotate',
],
// Note: order is bottom-to-top and/or right-to-left
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: 'last 3 versions',
},
useBuiltIns: 'entry',
corejs: 3,
modules: false,
},
],
[
'@babel/preset-typescript',
{
allowNamespaces: true,
},
],
'@babel/preset-react',
],
},
options: getBabelConfig(),
},
],
},