From 778faca1b475ee656694ec19327cb68409bfc551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Wed, 7 Aug 2024 01:57:53 +0900 Subject: [PATCH 1/8] =?UTF-8?q?chore:=20env.prod,=20env.dev=20=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20gitignore=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/.gitignore b/client/.gitignore index afd0485d1..2df1bb71c 100644 --- a/client/.gitignore +++ b/client/.gitignore @@ -5,7 +5,7 @@ npm-debug.log* node_modules dist -.env +.env.* *storybook.log .DS_Store From 72968565cf2643429ea5492616f499c18458ff59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Wed, 7 Aug 2024 01:58:17 +0900 Subject: [PATCH 2/8] =?UTF-8?q?chore:=20dev,=20prod=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EC=9D=98=20=EA=B3=B5=ED=86=B5=20=EC=84=A4=EC=A0=95=EC=9D=84=20?= =?UTF-8?q?webpack.common.mjs=20=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/webpack.common.mjs | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 client/webpack.common.mjs diff --git a/client/webpack.common.mjs b/client/webpack.common.mjs new file mode 100644 index 000000000..fc39ac87b --- /dev/null +++ b/client/webpack.common.mjs @@ -0,0 +1,56 @@ +import path from 'path'; +import HtmlWebpackPlugin from 'html-webpack-plugin'; +import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; +import {ModifySourcePlugin, ConcatOperation} from 'modify-source-webpack-plugin'; +import {fileURLToPath} from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +export default { + entry: './src/index.tsx', + resolve: { + extensions: ['.js', '.jsx', '.ts', '.tsx'], + alias: { + '@apis': path.resolve(__dirname, 'src/apis/'), + '@assets': path.resolve(__dirname, 'src/assets/'), + '@components': path.resolve(__dirname, 'src/components/'), + '@constants': path.resolve(__dirname, 'src/constants/'), + '@hooks': path.resolve(__dirname, 'src/hooks/'), + '@mocks': path.resolve(__dirname, 'src/mocks/'), + '@pages': path.resolve(__dirname, 'src/pages/'), + '@utils': path.resolve(__dirname, 'src/utils/'), + }, + }, + module: { + rules: [ + { + test: /\.tsx?$/, + loader: 'ts-loader', + exclude: /node_modules/, + }, + { + test: /\.svg$/, + use: [ + { + loader: '@svgr/webpack', + }, + ], + }, + ], + }, + plugins: [ + new HtmlWebpackPlugin({ + template: './index.html', + }), + new ForkTsCheckerWebpackPlugin(), + new ModifySourcePlugin({ + rules: [ + { + test: /\.tsx$/i, + operations: [new ConcatOperation('start', '/** @jsxImportSource @emotion/react */\n\n')], + }, + ], + }), + ], +}; From 7d9e328161877cf5c1bfe2f12ea2cda67a84bb9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Wed, 7 Aug 2024 01:58:40 +0900 Subject: [PATCH 3/8] =?UTF-8?q?chore:=20dev,=20prod=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20webpack=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=B4=20webpack.dev.mjs,=20webpack.pro?= =?UTF-8?q?d.mjs=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/webpack.dev.mjs | 30 ++++++++++++++++++++++++++++++ client/webpack.prod.mjs | 25 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 client/webpack.dev.mjs create mode 100644 client/webpack.prod.mjs diff --git a/client/webpack.dev.mjs b/client/webpack.dev.mjs new file mode 100644 index 000000000..8fe013441 --- /dev/null +++ b/client/webpack.dev.mjs @@ -0,0 +1,30 @@ +import path from 'path'; +import {merge} from 'webpack-merge'; +import Dotenv from 'dotenv-webpack'; +import common from './webpack.common.mjs'; +import {fileURLToPath} from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +export default merge(common, { + mode: 'development', + output: { + filename: '[name].js', + chunkFilename: '[id].chunk.js', + path: path.resolve(__dirname, 'dist'), + clean: true, + publicPath: '/', + }, + devtool: 'eval-source-map', + devServer: { + port: 3000, + historyApiFallback: true, + hot: true, + }, + plugins: [ + new Dotenv({ + path: '.env.dev', + }), + ], +}); diff --git a/client/webpack.prod.mjs b/client/webpack.prod.mjs new file mode 100644 index 000000000..5df1f7c4c --- /dev/null +++ b/client/webpack.prod.mjs @@ -0,0 +1,25 @@ +import path from 'path'; +import {merge} from 'webpack-merge'; +import Dotenv from 'dotenv-webpack'; +import common from './webpack.common.mjs'; +import {fileURLToPath} from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +export default merge(common, { + mode: 'production', + output: { + filename: '[name].[hash].js', + chunkFilename: '[id].[hash].chunk.js', + path: path.resolve(__dirname, 'dist'), + clean: true, + publicPath: '/', + }, + devtool: 'source-map', + plugins: [ + new Dotenv({ + path: '.env.prod', + }), + ], +}); From af22d4d665385da058bfcaa1c2e727c068e3a4eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Wed, 7 Aug 2024 01:58:57 +0900 Subject: [PATCH 4/8] =?UTF-8?q?remove:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20webpack.config.js=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/webpack.config.js | 71 ---------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 client/webpack.config.js diff --git a/client/webpack.config.js b/client/webpack.config.js deleted file mode 100644 index 2c706beec..000000000 --- a/client/webpack.config.js +++ /dev/null @@ -1,71 +0,0 @@ -import path from 'path'; -import HtmlWebpackPlugin from 'html-webpack-plugin'; -import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; -import {ModifySourcePlugin, ConcatOperation} from 'modify-source-webpack-plugin'; -import {fileURLToPath} from 'url'; -import Dotenv from 'dotenv-webpack'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); - -// dotenv.config({path: path.join(__dirname, '.env')}); - -export default { - mode: 'development', - entry: './src/index.tsx', - resolve: { - extensions: ['.js', '.jsx', '.ts', '.tsx'], - alias: { - '@apis': path.resolve(__dirname, 'src/apis/'), - '@assets': path.resolve(__dirname, 'src/assets/'), - '@components': path.resolve(__dirname, 'src/components/'), - '@constants': path.resolve(__dirname, 'src/constants/'), - '@hooks': path.resolve(__dirname, 'src/hooks/'), - '@mocks': path.resolve(__dirname, 'src/mocks/'), - '@pages': path.resolve(__dirname, 'src/pages/'), - '@utils': path.resolve(__dirname, 'src/utils/'), - }, - }, - output: { - path: path.join(__dirname, 'dist'), - filename: 'bundle.min.js', - publicPath: '/', - }, - module: { - rules: [ - { - test: /\.tsx?$/, - loader: 'ts-loader', - exclude: /node_modules/, - }, - { - test: /\.svg$/, - use: [ - { - loader: '@svgr/webpack', - }, - ], - }, - ], - }, - plugins: [ - new HtmlWebpackPlugin({ - template: './index.html', - }), - new ForkTsCheckerWebpackPlugin(), - new ModifySourcePlugin({ - rules: [ - { - test: /\.tsx$/i, - operations: [new ConcatOperation('start', '/** @jsxImportSource @emotion/react */\n\n')], - }, - ], - }), - new Dotenv(), - ], - devServer: { - port: 3000, - hot: true, - historyApiFallback: true, - }, -}; From c44ed861ffc82b180dbe49c7df2117745067d1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Wed, 7 Aug 2024 01:59:28 +0900 Subject: [PATCH 5/8] =?UTF-8?q?chore:=20webpack-merge=20dependency=20?= =?UTF-8?q?=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/package-lock.json | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index 2b1894624..4324f6228 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -44,7 +44,8 @@ "typescript-eslint": "^7.16.0", "webpack": "^5.93.0", "webpack-cli": "^5.1.4", - "webpack-dev-server": "^5.0.4" + "webpack-dev-server": "^5.0.4", + "webpack-merge": "^6.0.1" }, "engines": { "node": ">=20.15.1", @@ -10561,6 +10562,20 @@ } } }, + "node_modules/webpack-cli/node_modules/webpack-merge": { + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", + "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "flat": "^5.0.2", + "wildcard": "^2.0.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/webpack-dev-middleware": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/webpack-dev-middleware/-/webpack-dev-middleware-7.3.0.tgz", @@ -10775,17 +10790,17 @@ } }, "node_modules/webpack-merge": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", - "integrity": "sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-6.0.1.tgz", + "integrity": "sha512-hXXvrjtx2PLYx4qruKl+kyRSLc52V+cCvMxRjmKwoA+CBbbF5GfIBtR6kCvl0fYGqTUPKB+1ktVmTHqMOzgCBg==", "dev": true, "dependencies": { "clone-deep": "^4.0.1", "flat": "^5.0.2", - "wildcard": "^2.0.0" + "wildcard": "^2.0.1" }, "engines": { - "node": ">=10.0.0" + "node": ">=18.0.0" } }, "node_modules/webpack-sources": { From 35781e58d569e1ec93d6d4809edf82d0518e7690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Wed, 7 Aug 2024 01:59:37 +0900 Subject: [PATCH 6/8] =?UTF-8?q?chore:=20package.json=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/package.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/package.json b/client/package.json index 833053883..b2101ae8e 100644 --- a/client/package.json +++ b/client/package.json @@ -4,8 +4,10 @@ "description": "", "type": "module", "scripts": { - "start": "webpack serve ", - "build": "webpack --mode production", + "prod": "NODE_ENV=production webpack server --open --config webpack.prod.mjs", + "dev": "NODE_ENV=development webpack server --open --config webpack.dev.mjs", + "build": "NODE_ENV=production webpack --config webpack.prod.mjs", + "build-dev": "NODE_ENV=development webpack --config webpack.dev.mjs", "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'", "format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,json,css,scss,md}'" }, @@ -54,4 +56,4 @@ "npm": ">=10.7.0", "node": ">=20.15.1" } -} +} \ No newline at end of file From a8a955a87fb5bd40e7769d986b9aa3b25793342d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Thu, 8 Aug 2024 11:02:54 +0900 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20webpack=20devserver=20overlay=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/webpack.dev.mjs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/webpack.dev.mjs b/client/webpack.dev.mjs index 8fe013441..5ad42ed45 100644 --- a/client/webpack.dev.mjs +++ b/client/webpack.dev.mjs @@ -21,6 +21,9 @@ export default merge(common, { port: 3000, historyApiFallback: true, hot: true, + client: { + overlay: false, + }, }, plugins: [ new Dotenv({ From 326f45e5f5dd1110092cb7215a80ab3858640182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=90=E1=85=A2=E1=84=92=E1=85=AE?= =?UTF-8?q?=E1=86=AB?= Date: Thu, 8 Aug 2024 11:06:14 +0900 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20webpack.common.mjs=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/webpack.common.mjs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/client/webpack.common.mjs b/client/webpack.common.mjs index ff351186d..fc39ac87b 100644 --- a/client/webpack.common.mjs +++ b/client/webpack.common.mjs @@ -22,14 +22,6 @@ export default { '@utils': path.resolve(__dirname, 'src/utils/'), }, }, -<<<<<<< HEAD:client/webpack.common.mjs -======= - output: { - path: path.join(__dirname, 'dist'), - filename: '[name].[hash].js', - publicPath: '/', - }, ->>>>>>> fe-dev:client/webpack.config.js module: { rules: [ { @@ -61,15 +53,4 @@ export default { ], }), ], -<<<<<<< HEAD:client/webpack.common.mjs -======= - devServer: { - port: 3000, - hot: true, - historyApiFallback: true, - client: { - overlay: false, - }, - }, ->>>>>>> fe-dev:client/webpack.config.js };