diff --git a/babel.config.json b/babel.config.json index 6547f06..ddd8302 100644 --- a/babel.config.json +++ b/babel.config.json @@ -1,4 +1,5 @@ { + "presets": ["@babel/preset-env"], "plugins": [ "@babel/plugin-proposal-optional-chaining", "babel-plugin-styled-components", diff --git a/src/browser/.babelrc.json b/src/browser/.babelrc.json deleted file mode 100644 index 3b2018d..0000000 --- a/src/browser/.babelrc.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "electron": "9" - } - } - ] - ] -} diff --git a/src/node/.babelrc.json b/src/node/.babelrc.json deleted file mode 100644 index a09dc40..0000000 --- a/src/node/.babelrc.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "modules": "commonjs", - "targets": { - "node": true - } - } - ] - ] -} diff --git a/src/web/.babelrc.json b/src/web/.babelrc.json deleted file mode 100644 index 9bbb8cf..0000000 --- a/src/web/.babelrc.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "modules": "commonjs", - "targets": "> 0.25%, not dead" - } - ] - ] -} diff --git a/webpack.config.js b/webpack.config.js index 6fe6629..19220b2 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,14 +1,17 @@ const path = require('path') const CopyPlugin = require('copy-webpack-plugin') -const baseConfig = { +const baseConfig = ({ babel }) => ({ mode: 'development', module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, - loader: 'babel-loader', + use: { + loader: 'babel-loader', + options: babel, + }, }, { test: /\.css$/i, @@ -40,10 +43,22 @@ const baseConfig = { 'react-dom': 'preact/compat', }, }, -} +}) const nodeConfig = { - ...baseConfig, + ...baseConfig({ + babel: { + presets: [ + [ + '@babel/preset-env', + { + modules: 'commonjs', + targets: { node: true }, + }, + ], + ], + }, + }), target: 'electron-main', entry: { index: './src/node/index.js', @@ -54,7 +69,11 @@ const nodeConfig = { } const browserConfig = { - ...baseConfig, + ...baseConfig({ + babel: { + presets: [['@babel/preset-env', { targets: { electron: '9' } }]], + }, + }), devtool: 'cheap-source-map', target: 'electron-renderer', entry: { @@ -68,7 +87,19 @@ const browserConfig = { } const webConfig = { - ...baseConfig, + ...baseConfig({ + babel: { + presets: [ + [ + '@babel/preset-env', + { + modules: 'commonjs', + targets: '> 0.25%, not dead', + }, + ], + ], + }, + }), devtool: 'cheap-source-map', target: 'web', entry: {