hyunnnn
@hahahahe
Reviews Written
1
Average Rating
5.0
Posts
Q&A
react-router-dom@6 nested route
๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค. webpack.config.ts ํ์ผ์์devServer: { historyApiFallback: true,historyApiFallback ์ค์ ํธ๋ฃจ๋ก ๋์ด์์ด์. path="/signup"๋ก ํ๋ฉด ๋์ค๋ signup ์ปดํฌ๋ํธ๊ฐ path="/signup/form" ์ผ๋ก ๋ฐ๊ฟ์ ์ฌ๋์ฌ ํ๋ ๋ ์ฐ๋ฉด SignUp ์ปดํฌ๋ํธ๋ ์๋ณด์ด๋ค์.. (์ฌ์ง)(์ฌ์ง)ํฐ๋ฏธ๋์ ๋ณด๋๊น ์๋ฌ๊ฐ ๋ณ๋๋ผ๊ตฌ์.. (์ฌ์ง)Error parsing bundle asset ํด๊ฒฐํ๋ ค๊ณ ๊ตฌ๊ธํด๋ดค๋๋ฐ ์ณ์ ๋ฐฉ๋ฒ์ธ์ง๋ ๋ชจ๋ฅด๊ฒ ์ง๋ง.. ์๋ ์ฝ๋งจ๋๋ฅผ ํฐ๋ฏธ๋์ ์ณ๋ดค์ต๋๋ค.webpack --profile --json > stats.json && webpack-bundle-analyzer stats.json dist/(์ฌ์ง)์ด๋ฐ ์๋ฌ๊ฐ ๋น๋๋ค..์๋๋ ์ webpack.config.ts ํ์ผ์ ๋๋ค.import path from 'path'; import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'; import webpack, { Configuration as WebpackConfiguration } from 'webpack'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server'; interface Configuration extends WebpackConfiguration { devServer?: WebpackDevServerConfiguration; } const isDevelopment = process.env.NODE_ENV !== 'production'; const config: Configuration = { name: 'slact-front', mode: isDevelopment ? 'development' : 'production', devtool: !isDevelopment ? 'hidden-source-map' : 'inline-source-map', resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'], alias: { '@hooks': path.resolve(__dirname, 'hooks'), '@components': path.resolve(__dirname, 'components'), '@layouts': path.resolve(__dirname, 'layouts'), '@pages': path.resolve(__dirname, 'pages'), '@utils': path.resolve(__dirname, 'utils'), '@typings': path.resolve(__dirname, 'typings'), }, }, entry: { app: './client', }, target: ['web', 'es5'], module: { rules: [ { test: /\.tsx?$/, loader: 'babel-loader', options: { presets: [ [ '@babel/preset-env', { targets: { browsers: ['IE 10'] }, debug: isDevelopment, }, ], '@babel/preset-react', '@babel/preset-typescript', ], env: { development: { plugins: [ ['@emotion/babel-plugin', { sourceMap: true }], require.resolve('react-refresh/babel'), ], }, production: { plugins: ['@emotion/babel-plugin'], }, }, }, }, { test: /\.css?$/, use: ['style-loader', 'css-loader'], }, ], }, plugins: [ new ForkTsCheckerWebpackPlugin({ async: false, // eslint: { // files: "./src/**/*", // }, }), new webpack.EnvironmentPlugin({ NODE_ENV: isDevelopment ? 'development' : 'production', }), ], output: { path: path.join(__dirname, 'dist'), filename: '[name].js', publicPath: '/dist/', }, devServer: { historyApiFallback: true, port: 3090, devMiddleware: { publicPath: '/dist/' }, static: { directory: path.resolve(__dirname) }, hot: true, proxy: { '/api/': { target: 'http://localhost:3095', changeOrigin: true, ws: true, }, }, }, }; if (isDevelopment && config.plugins) { config.plugins.push(new webpack.HotModuleReplacementPlugin()); config.plugins.push( new ReactRefreshWebpackPlugin({ overlay: { useURLPolyfill: true, }, }), ); config.plugins.push( new BundleAnalyzerPlugin({ analyzerMode: 'server', openAnalyzer: false }), ); } if (!isDevelopment && config.plugins) { config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true })); config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static' })); } export default config;
- 0
- 2
- 940
Q&A
ํน์ ํํธ 2๋ ์ธ์ ์ฏค ๋์ฌ๊น์?
๊ฐ์ฌํฉ๋๋ค.
- 0
- 2
- 224




