-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
65 lines (61 loc) · 1.61 KB
/
webpack.config.js
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
58
59
60
61
62
63
64
65
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const fs = require('fs');
var base = {
resolve: {
extensions: ['.ts', '.tsx', '.web.js', '.js', '.jsx', '.webpack.js', '.scss']
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
loader: "source-map-loader"
},
{
test: /\.tsx?$/,
loader: 'ts-loader'
},
{
test: /\.s(c|a)ss$/,
loaders: ['style-loader', 'css-loader?sourceMap', 'sass-loader?sourceMap']
}
]
}
}
var client = {
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/index.tsx',
],
output: {
path: path.join(process.cwd(), '/build'),
publicPath: '/',
filename: 'client.js',
},
plugins: [
new webpack.HotModuleReplacementPlugin({quiet: true}),
new HtmlWebpackPlugin({template: 'src/index.html'})
],
devServer: {
hot: true,
quiet: false,
clientLogLevel: 'info',
historyApiFallback: {
index: 'index.html'
},
proxy: {
"/wp-json": {
target: "http://krlx.org",
changeOrigin: true
},
"/data.php": {
target: "http://live.krlx.org/data.php",
changeOrigin: true
}
}
}
};
module.exports = Object.assign(client, base);