-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.ts
53 lines (51 loc) · 1.31 KB
/
webpack.config.ts
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
/// <reference path="node_modules/webpack-dev-server/types/lib/Server.d.ts"/>
import { Configuration } from 'webpack'
import path from 'path'
import HtmlWebpackPlugin from 'html-webpack-plugin'
const config: Configuration = {
// 絶対パスでwebpackに取ってのルートとなるフォルダを指定する
context: path.join(__dirname, 'src'),
entry: './index.tsx',
output: {
path: path.join(__dirname, 'frontend'),
filename: '[name].js',
},
module: {
rules: [
{
// ts, tsxを変換対象とする
test: /\.tsx?$/,
use: 'ts-loader',
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.join(__dirname, 'public', 'index.html'),
inject: 'body',
}),
],
mode: 'development',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
},
// コンパイル後のjsを元のtsファイルと結びつける事でデバッグし易くする
devtool: 'inline-source-map',
devServer: {
static: path.join(__dirname, 'pulic'),
open: false,
port: 8080,
proxy: {
'/create-payment-intent': {
target: 'http://localhost:4242',
secure: false,
logLevel: 'debug',
},
},
},
}
export default config