From 7dbc0079aacee2db70b11c726315a41ff797d869 Mon Sep 17 00:00:00 2001 From: solo5star Date: Thu, 28 Sep 2023 15:33:02 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20storybook=EC=97=90=EC=84=9C=20babel=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=EC=9D=84=20=EC=9D=BD=EC=9D=84=20=EC=88=98=20?= =?UTF-8?q?=EC=9E=88=EB=8F=84=EB=A1=9D=20.babelrc.js=20=EB=A1=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/.babelrc.js | 16 ++++++++++++++++ client/webpack.common.js | 21 +-------------------- 2 files changed, 17 insertions(+), 20 deletions(-) create mode 100644 client/.babelrc.js diff --git a/client/.babelrc.js b/client/.babelrc.js new file mode 100644 index 00000000..c0fa9dcc --- /dev/null +++ b/client/.babelrc.js @@ -0,0 +1,16 @@ +import ReactFreshBabelPlugin from 'react-refresh/babel'; + +/** @type {import('@babel/core').TransformOptions} */ +export default { + presets: [ + [ + '@babel/preset-react', + { + runtime: 'automatic', + development: process.env.NODE_ENV === 'development', + }, + ], + '@babel/preset-typescript', + ], + plugins: [process.env.NODE_ENV === 'development' && false && ReactFreshBabelPlugin].filter(Boolean), +}; diff --git a/client/webpack.common.js b/client/webpack.common.js index c0725a2d..48df3ea1 100644 --- a/client/webpack.common.js +++ b/client/webpack.common.js @@ -3,11 +3,8 @@ import DotenvWebpackPlugin from 'dotenv-webpack'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import { dirname } from 'path'; -import ReactFreshBabelPlugin from 'react-refresh/babel'; import { fileURLToPath } from 'url'; -export const IS_DEV = process.env.NODE_ENV === 'development'; - /** @type {import('webpack').Configuration} */ export default { // https://github.com/TypeStrong/fork-ts-checker-webpack-plugin#installation @@ -26,23 +23,7 @@ export default { { test: /\.[tj]sx?$/i, exclude: /node_modules/, - use: { - loader: 'babel-loader', - /** @type {import('@babel/core').TransformOptions} */ - options: { - presets: [ - [ - '@babel/preset-react', - { - runtime: 'automatic', - development: IS_DEV, - }, - ], - '@babel/preset-typescript', - ], - plugins: [IS_DEV && ReactFreshBabelPlugin].filter(Boolean), - }, - }, + use: 'babel-loader', }, ], },