forked from microsoft/FluidHelloWorld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
40 lines (35 loc) · 1015 Bytes
/
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
/*!
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = env => {
const htmlTemplate = "./src/index.html";
const plugins = env && env.clean
? [new CleanWebpackPlugin(), new HtmlWebpackPlugin({ template: htmlTemplate })]
: [new HtmlWebpackPlugin({ template: htmlTemplate })];
const mode = env && env.prod
? "production"
: "development";
return {
devtool: "inline-source-map",
entry: {
app: "./src/app.ts",
},
mode,
module: {
rules: [{
test: /\.tsx?$/,
loader: "ts-loader"
}]
},
output: {
filename: "[name].[contenthash].js",
},
plugins,
resolve: {
extensions: [".ts", ".js"],
},
};
};