-
-
Notifications
You must be signed in to change notification settings - Fork 183
/
Copy pathwebpack.config.js
68 lines (65 loc) · 2.08 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
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var releaseConfig = require("./webpack.config.release");
var isProductionEnvironment =
process.env.ASPNETCORE_ENVIRONMENT === "Production";
var path = require("path");
var merge = require("extendify")({ isDeep: true, arrays: "replace" });
var config = {
mode: "development",
entry: {
main: path.join(__dirname, "boot.tsx")
},
output: {
path: path.join(__dirname, "../api/", "wwwroot"),
filename: "[name].js",
publicPath: "/"
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".styl", ".css"]
},
module: {
rules: [
{
test: /\.styl$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
modules: true,
importLoaders: 2,
sourceMap: false
}
},
{
loader: "stylus-loader"
}
]
},
{ test: /\.ts(x?)$/, loaders: ["ts-loader"] },
{ test: /\.css/, loader: "style-loader!css-loader" },
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: "url-loader?limit=100000"
}
]
},
devtool: "inline-source-map",
plugins: [
// plugins should not be empty: https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices'[
new HtmlWebpackPlugin({
template: path.join(__dirname, "index.ejs"),
inject: true
})
// new webpack.NamedModulesPlugin()
// We do not use ExtractTextPlugin in development mode so that HMR will work with styles
]
};
if (isProductionEnvironment) {
// Merge production config
config = merge(config, releaseConfig);
}
module.exports = config;