Skip to content

Commit a0fcbe2

Browse files
committedOct 29, 2017
Webpack with typescript
1 parent 818fe4b commit a0fcbe2

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
 

Diff for: ‎webpack/webpack-with-typescript.js

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const path = require("path");
2+
const webpack = require("webpack");
3+
4+
const DEBUG = process.env.NODE_ENV !== "production";
5+
6+
module.exports = {
7+
entry: {
8+
"index": [
9+
path.resolve(__dirname, INPUTFILE)
10+
]
11+
},
12+
devtool: DEBUG ? "inline-sourcemap" : false,
13+
cache: true,
14+
output: {
15+
path: path.resolve(__dirname, 'libs/'),
16+
filename: "[name].js"
17+
},
18+
module: {
19+
rules: [
20+
{
21+
test: /\.(ts|js)$/,
22+
exclude: /(node_modules)/,
23+
use: {
24+
loader: "ts-loader"
25+
}
26+
}
27+
]
28+
},
29+
resolve: {
30+
extensions: [
31+
".ts",
32+
".js"
33+
]
34+
},
35+
plugins: []
36+
};
37+
38+
if (!DEBUG) {
39+
module.exports.output.filename = "[name].min.js";
40+
41+
module.exports.plugins.push(
42+
new webpack.optimize.UglifyJsPlugin()
43+
);
44+
}

0 commit comments

Comments
 (0)
Please sign in to comment.