-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
100 lines (99 loc) · 2.69 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
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
// noinspection JSUnresolvedVariable
module.exports = {
devtool: "cheap-module-source-map",
entry: __dirname + '/src/index.ts',
output: {
path: __dirname + '/build/',
publicPath: '/',
filename: 'bundle.js'
},
devServer: {
contentBase: __dirname + '/build',
historyApiFallback: true,
inline: true
},
resolve: {
extensions: ['.ts', '.js', '.tsx', '.jsx', '.css']
},
module: {
rules: [
{
test: /(\.tsx|\.ts)$/,
exclude: /node_module/,
use: [
{
loader: 'ts-loader'
}
],
},
{
test: /(\.jsx|\.js)$/,
exclude: /node_module/,
use: {
loader: 'ts-loader'
}
},
{
test: /\.css$/,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
},
},
]
},
{
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: "file-loader"
}
},
{
test: /\.(woff|woff2)$/,
use: {
loader: "url-loader?prefix=font/&limit=5000"
}
},
{
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: "url-loader?limit=10000&mimetype=application/octet-stream"
}
},
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
use: {
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
}
},
{
test: /\.png$/,
use: {
loader: 'url-loader?limit=10000&name=img/[name].[ext]'
}
},
{
test: /\.(vert|frag|geom|mtl|obj)$/,
use: 'raw-loader'
}
]
},
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: 'public/index.html'
}),
new CopyWebpackPlugin([
{
from: 'assets',
to: 'assets'
}
])
]
};