-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
95 lines (92 loc) · 2.26 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
var path = require('path');
var webpack = require('webpack');
const config = require("./config");
module.exports = {
context: path.resolve(__dirname, "./client/"),
entry: {
App: './index.tsx',
commons: ['jquery']
},
output: {
path: path.resolve(__dirname, "./public/static"),
filename: "./bundles/[name].js",
publicPath: "http://" + config.server.host + ":" + config.server.port + "/static/"
},
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json"]
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{ test: /\.tsx?$/, loader: "awesome-typescript-loader" },
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" },
{
test: /\.css$/,
exclude: /node_modules/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
modules: true
}
}
]
},
{
test: /\.scss$/,
exclude: /node_modules/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader",
options: {
modules: true,
minimize: true,
localIdentName: '_[hash:base64:5]'
}
}, {
loader: "sass-loader",
options: {
modules: true
}
}]
},
{
test: /\.js$/,
exclude: [/node_modules/],
use: [{
loader: 'babel-loader',
options: {
presets: ['es2015', 'react']
}
}]
},
{
test: /\.(png|jpg)$/,
exclude: /node_modules/,
use: ["url?limit=100000"]
},
{
test: /\.jpg/,
exclude: /node_modules/,
use: ['file']
},
{
test: /\.(eot|svg|ttf|woff|woff2|otf)$/,
use: ['file?name=public/fonts/[name].[ext]']
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
}),
new webpack.optimize.CommonsChunkPlugin("./webpack-commons"),
]
}