forked from anyproto/anytype-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
109 lines (102 loc) · 2.29 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
const path = require('path');
const process = require('process');
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = (env, argv) => {
const port = process.env.SERVER_PORT;
return {
mode: 'development',
devtool: 'source-map',
optimization: {
minimize: false,
removeAvailableModules: true,
removeEmptyChunks: true,
splitChunks: false,
},
entry: {
app: {
import: './src/ts/entry.tsx',
filename: 'main.js',
},
extension: {
import: './extension/entry.tsx',
filename: 'extension/js/main.js',
},
},
resolve: {
extensions: [ '.ts', '.tsx', '.js', '.jsx' ],
alias: {
dist: path.resolve(__dirname, 'dist'),
protobuf: path.resolve(__dirname, 'dist/lib'),
json: path.resolve(__dirname, 'src/json'),
Lib: path.resolve(__dirname, 'src/ts/lib'),
Store: path.resolve(__dirname, 'src/ts/store'),
Component: path.resolve(__dirname, 'src/ts/component'),
Interface: path.resolve(__dirname, 'src/ts/interface'),
Model: path.resolve(__dirname, 'src/ts/model'),
Docs: path.resolve(__dirname, 'src/ts/docs'),
},
modules: [
path.resolve('./src/'),
path.resolve('./electron/'),
path.resolve('./dist/'),
path.resolve('./node_modules')
]
},
devServer: {
hot: true,
static: {
directory: path.join(__dirname, 'dist'),
watch: {
ignored: [
path.resolve(__dirname, 'dist'),
path.resolve(__dirname, 'node_modules')
],
usePolling: false,
},
},
historyApiFallback: true,
host: 'localhost',
port,
client: {
progress: false,
},
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
loader: 'ts-loader'
},
{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader'
},
{
test: /\.(eot|ttf|otf|woff|woff2)$/,
loader: 'url-loader'
},
{
test: /\.(jpe?g|png|gif|svg)$/,
loader: 'url-loader'
},
{
test: /\.s?css/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'sass-loader' }
]
}
]
},
plugins: [
//new BundleAnalyzerPlugin(),
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
],
};
};