Skip to content

Commit

Permalink
Reconfigure babel settings
Browse files Browse the repository at this point in the history
  • Loading branch information
zourdyzou committed Jun 26, 2022
1 parent 548f602 commit 0ea2981
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 44 deletions.
42 changes: 2 additions & 40 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,3 @@
/* eslint-env node */

module.exports = (api) => {
const isTest = api.env("test");
const isDev = api.env("development");
return {
plugins: [...(isDev ? ["react-refresh/babel"] : [])],
presets: [
[
"@babel/env",
{
bugfixes: true,
useBuiltIns: "usage",
corejs: 3,
shippedProposals: true,
...(isTest
? {
targets: {
node: "current",
},
}
: {}),
},
],
[
"@babel/react",
{
useBuiltIns: true,
runtime: "automatic",
},
],
[
"@babel/typescript",
{
allowDeclareFields: true,
onlyRemoveTypeImports: true,
},
],
],
};
module.exports = {
presets: ["@babel/preset-env", "@babel/preset-typescript", "@babel/preset-react"],
};
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production --node-env=production",
"watch": "webpack --watch --mode=development",
"serve": "webpack serve --mode=development",
"build:production": "npm run clean:dist && webpack --mode=production --node-env=production",
"build:development": "npm run clean:dist && webpack --mode=development --node-env=development",
"start": "webpack serve --mode=development",
"clean": "rm -rf node_modules coverage dist",
"clean:dist": "rm -rf dist",
"test": "jest"
},
"directories": {
Expand Down Expand Up @@ -38,6 +42,7 @@
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.0",
"react-refresh": "^0.13.0",
"@types/jest": "^28.1.3",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
Expand Down
5 changes: 2 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const BundleAnalyzerPlugin =
require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
const { CleanWebpackPlugin } = require("clean-webpack-plugin");

module.exports = {
Expand All @@ -11,7 +10,7 @@ module.exports = {
filename: "bundle.js",
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
extensions: [".tsx", ".ts", ".js", ".d.ts", ".scss"],
},
module: {
rules: [
Expand Down

0 comments on commit 0ea2981

Please sign in to comment.