rail
@judypark316417
Reviews Written
-
Average Rating
-
Posts
Q&A
swr, gravatar ์๋ฌ
์ ๋ก์ด๋! ๋ง์ ์ฃผ์ ๋๋ก ๋ค์ ๊ฐ์๋ฅผ ๋ฃ๊ณ ๋ฅผ ์ฝ๋์ ์ถ๊ฐํ์๋๋ ์์ ์๋ฌ๋ฉ์ธ์ง๋ค์ด ํด๊ฒฐ๋์์ต๋๋ค. ๊ทธ๋ฐ๋ฐ ์ด๋ฒ์๋ ์ด๋ฐ ์๋ฌ๊ฐ ๋ฐ์ํ์์ต๋๋ค. (์ฌ์ง) ๋ฅผ ๋ค์ ๋นผ๋ณด๋ฉด ์ด๋ถ๋ถ์ ์๋ฌ๊ฐ ์ฌ๋ผ์ง๊ณ mutate(false, false) , userData.email , userData.nickname ๋ถ๋ถ์ ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค. ๊นํ์ ์์ค์ฝ๋๋ฅผ ๋ณด๊ณ ํน์๋ ์ถ์ด url ๋ถ๋ถ์ 'api/users'๋ก ๋ณ๊ฒฝํด๋ณด์์ง๋ง ์๋ฌ๋ ๊ทธ๋๋ก์ ๋๋ค.. ใ ใ // db.ts export interface IUser { id: number; nickname: string; email: string; Workspaces: IWorkspace[]; } // fetcher.ts import axios from 'axios'; const fetcher = (url: string) => { axios.get(url, { withCredentials: true }).then((response) => response.data); }; export default fetcher;
- 0
- 2
- 429
Q&A
npm run dev - webpack-cli ์๋ฌ
์ ์ด์ฃผ์ ๋๋ก ์ ๋ ฅํด๋ดค๋๋ฐ ์๋ฌ๊ฐ ๋ฉ๋๋ค.. configuration ํ์ ์ ๋ฌธ์ ๊ฐ ์๋๊ฑด๊ฐ์? (์ฌ์ง) ์๋๋ ํฐ๋ฏธ๋์์ npm run dev ํ์ ๋ ์๋ฌ์ด๊ณ , [webpack-cli] Failed to load 'C:\Users\user\Desktop\coding\sleact\client\webpack.config.ts' config [webpack-cli] webpack.config.ts:80:5 - error TS2322: Type '{ historyApiFallback: true; port: number; static: { publicPath: string; }; }' is not assignable to type 'Configuration'. Object literal may only specify known properties, and 'static' does not exist in type 'Configuration'. 80 static: { publicPath: '/dist/' }, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ node_modules/@types/webpack-dev-server/index.d.ts:352:9 352 devServer?: WebpackDevServer.Configuration; ~~~~~~~~~ The expected type comes from property 'devServer' which is declared here on type 'Configuration' npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! client@1.0.0 dev: `cross-env TS_NODE_PROJECT="tsconfig-for-webpack-config.json" webpack serve --env development` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the client@1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\user\AppData\Roaming\npm-cache\_logs\2021-08-26T14_46_22_658Z-debug.log ์๋๋ webpack.config.ts ํ์ผ ๋ด์ฉ์ ๋๋ค. import path from 'path'; import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'; import webpack from 'webpack'; import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; // import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; const isDevelopment = process.env.NODE_ENV !== 'production'; const config: webpack.Configuration = { name: 'sleact', mode: isDevelopment ? 'development' : 'production', devtool: !isDevelopment ? 'hidden-source-map' : 'eval', 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', }, module: { rules: [ { test: /\.tsx?$/, loader: 'babel-loader', options: { presets: [ [ '@babel/preset-env', { targets: { browsers: ['last 2 chrome versions'] }, debug: isDevelopment, }, ], '@babel/preset-react', '@babel/preset-typescript', ], env: { development: { plugins: [['@emotion', { sourceMap: true }], require.resolve('react-refresh/babel')], }, production: { plugins: ['@emotion'], }, }, }, exclude: path.join(__dirname, 'node_modules'), }, { test: /\.css?$/, use: ['style-loader', 'css-loader'], }, ], }, plugins: [ // ts์ webpack ๋์์ ๋์๊ฐ๊ฒ ํด์ฃผ๋ ํ๋ฌ๊ทธ์ธ 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, // react router port: 3090, // publicPath: '/dist/', static: { publicPath: '/dist/' }, // proxy: { // '/api/': { // target: 'http://localhost:3095', // changeOrigin: true, // }, // }, }, }; if (isDevelopment && config.plugins) { config.plugins.push(new webpack.HotModuleReplacementPlugin()); config.plugins.push(new ReactRefreshWebpackPlugin()); // config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'server', openAnalyzer: true })); } if (!isDevelopment && config.plugins) { // config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true })); // config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static' })); } export default config;
- 0
- 2
- 1.2K
Q&A
npm run build ์๋ฌ
์ด ๋ถ๋ถ ๋ง์์ด์ ๊ฑฐ์ฃ ~? if (isDevelopment && config.plugins) { config.plugins.push(new webpack.HotModuleReplacementPlugin()); config.plugins.push(new ReactRefreshWebpackPlugin()); // config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'server', openAnalyzer: true })); } if (!isDevelopment && config.plugins) { // config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true })); // config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static' })); }
- 0
- 4
- 964
Q&A
npm run build ์๋ฌ
๋ง์ํด์ฃผ์ ํ์ผ ๋ณด๊ณ emotion ์ถ๊ฐ ์ค์นํ์ต๋๋ค! ๊ทธ๋ฐ๋ฐ ์ฌ์ ํ ํ๋ฉด์ ์๋ฌด๊ฒ๋ ๋ ๋๋ง์ด ๋์ง ์๊ณ ๊ฐ๋ฐ์ ๋๊ตฌ ์ด์ด๋ณด๋ ์ด๋ฐ ์๋ฌ๊ฐ ์์ต๋๋ค..ใ ใ ์ด๊ฒ๋ ์ค์น ๋ฌธ์ ์ผ๊น์..? (์ฌ์ง) "dependencies": { "@emotion/babel-plugin": "^11.3.0", "@types/react": "^17.0.19", "@types/react-dom": "^17.0.9", "cross-env": "^7.0.3", "css-loader": "^6.2.0", "react": "^17.0.2", "react-dom": "^17.0.2", "style-loader": "^3.2.1", "ts-node": "^10.2.1", "typescript": "^4.3.5", "webpack-cli": "^4.8.0" }, "devDependencies": { "@babel/core": "^7.15.0", "@babel/preset-env": "^7.15.0", "@babel/preset-react": "^7.14.5", "@babel/preset-typescript": "^7.15.0", "@types/node": "^16.7.1", "@types/webpack": "^5.28.0", "babel-loader": "^8.2.2", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^3.4.1", "prettier": "^2.3.2", "react-refresh": "^0.10.0", "webpack": "^5.51.1" }
- 0
- 4
- 964
Q&A
npm run build ์๋ฌ
์~ setting ํด๋ ์์ package.json์ด ์๋๋ผ ์์ฑ๋ณธ์ ์๋ package.json ํ์ผ ๋ณด๊ตฌ ์ค์นํด์ผํ๋๊ฑด๊ฐ๋ณด๋ค์
- 0
- 4
- 964
Q&A
dist ํด๋๊ฐ ์๊ธฐ์ง ์์ต๋๋ค.
์์! ๋๋ถ์ ์๋ฌธ์ด ํด๊ฒฐ๋์์ต๋๋ค. ๋ต๋ณ ๊ฐ์ฌํฉ๋๋คโค
- 0
- 2
- 1.3K




