Extract Babel config
This commit is contained in:
parent
c718d16f1c
commit
705a6d6359
3 changed files with 21 additions and 22 deletions
20
babel.config.js
Normal file
20
babel.config.js
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
module.exports = {
|
||||||
|
babelrcRoots: [
|
||||||
|
// Keep the root as a root
|
||||||
|
'.'
|
||||||
|
],
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'@babel/preset-env',
|
||||||
|
{
|
||||||
|
useBuiltIns: 'usage',
|
||||||
|
corejs: 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
'@babel/plugin-proposal-class-properties',
|
||||||
|
'@babel/plugin-proposal-private-methods',
|
||||||
|
'babel-plugin-dynamic-import-polyfill'
|
||||||
|
]
|
||||||
|
};
|
16
package.json
16
package.json
|
@ -77,22 +77,6 @@
|
||||||
"workbox-core": "^5.1.4",
|
"workbox-core": "^5.1.4",
|
||||||
"workbox-precaching": "^5.1.4"
|
"workbox-precaching": "^5.1.4"
|
||||||
},
|
},
|
||||||
"babel": {
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"@babel/preset-env",
|
|
||||||
{
|
|
||||||
"useBuiltIns": "usage",
|
|
||||||
"corejs": 3
|
|
||||||
}
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"@babel/plugin-proposal-class-properties",
|
|
||||||
"@babel/plugin-proposal-private-methods",
|
|
||||||
"babel-plugin-dynamic-import-polyfill"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 2 Firefox versions",
|
"last 2 Firefox versions",
|
||||||
"last 2 Chrome versions",
|
"last 2 Chrome versions",
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
||||||
const CopyPlugin = require('copy-webpack-plugin');
|
const CopyPlugin = require('copy-webpack-plugin');
|
||||||
const packageConfig = require('./package.json');
|
|
||||||
const WorkboxPlugin = require('workbox-webpack-plugin');
|
const WorkboxPlugin = require('workbox-webpack-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
|
@ -93,10 +92,7 @@ module.exports = {
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules[\\/](?!@uupaa[\\/]dynamic-import-polyfill|date-fns|epubjs|flv.js|libarchive.js)/,
|
exclude: /node_modules[\\/](?!@uupaa[\\/]dynamic-import-polyfill|date-fns|epubjs|flv.js|libarchive.js)/,
|
||||||
use: [{
|
use: [{
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader'
|
||||||
options: {
|
|
||||||
presets: packageConfig.babel.presets
|
|
||||||
}
|
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
/* modules that Babel breaks when transforming to ESM */
|
/* modules that Babel breaks when transforming to ESM */
|
||||||
|
@ -105,7 +101,6 @@ module.exports = {
|
||||||
use: [{
|
use: [{
|
||||||
loader: 'babel-loader',
|
loader: 'babel-loader',
|
||||||
options: {
|
options: {
|
||||||
presets: packageConfig.babel.presets,
|
|
||||||
plugins: [
|
plugins: [
|
||||||
'@babel/transform-modules-umd'
|
'@babel/transform-modules-umd'
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue