-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
57 lines (55 loc) · 1.35 KB
/
webpack.config.js
File metadata and controls
57 lines (55 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const dotenv = require('dotenv');
module.exports = () => {
dotenv.config();
return {
entry: path.resolve(__dirname, 'src/index.jsx'),
mode: 'development',
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: 'babel-loader',
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
'@fixtures': path.resolve(__dirname, 'fixtures'),
},
},
devServer: {
historyApiFallback: {
index: '/index.html',
},
proxy: {
'/api': { // /api로 시작하면 아래의 타켓으로 이동
target: 'https://nextjsintro-flame.vercel.app',
changeOrigin: true,
},
},
},
// devServer: {
// historyApiFallback: {
// index: 'index.html',
// },
// },
// devServer: {
// historyApiFallback: true,
// },
plugins: [
new webpack.DefinePlugin({
'process.env': JSON.stringify(process.env),
}),
// build 시 index.html 템플릿을 사용하여 html 파일을 생성
new HtmlWebpackPlugin({
template: path.resolve(__dirname, './public/index.html'),
publicPath: '/',
}),
],
};
};