Skip to content

Commit

Permalink
fix: storybook에서 babel 설정을 읽을 수 있도록 .babelrc.js 로 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
solo5star committed Sep 28, 2023
1 parent 6399bb3 commit 7dbc007
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
16 changes: 16 additions & 0 deletions client/.babelrc.js
Original file line number Diff line number Diff line change
@@ -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),
};
21 changes: 1 addition & 20 deletions client/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
},
],
},
Expand Down

0 comments on commit 7dbc007

Please sign in to comment.