This repository has been archived by the owner on Feb 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
/
webpack.config.js
54 lines (52 loc) · 1.51 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
// Prepack Disabled due to Invariant Violation error also prepack not yet compatible with node 8
// const PrepackWebpackPlugin = require("prepack-webpack-plugin").default;
const path = require("path");
const webpack = require("webpack");
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const entry = process.env.NODE_ENV === "dev" ? {"turboscript": "./src/index.ts"} : {
"turboscript": "./src/index.ts",
"turboscript.min": "./src/index.ts"
};
module.exports = {
target: "node",
entry: entry,
devtool: "source-map",
resolve: {
// Add ".ts" and ".tsx" as a resolvable extension.
extensions: [".ts", ".js"]
},
plugins: [
// new PrepackWebpackPlugin({})
new webpack.DefinePlugin({
VERSION: JSON.stringify(require("./package.json").version)
}),
new UglifyJsPlugin({
mangle: false, compress: true,
minimize: true,
include: /\.min\.js$/,
})
],
module: {
rules: [
{
test: /\.(tbs|txt)$/,
loader: "raw-loader"
},
{
test: /\.(wasm)$/,
loader: "bin-loader"
},
{
test: /\.tsx?$/,
loader: "ts-loader",
exclude: /node_modules/,
}
]
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "lib"),
library: "turboscript",
libraryTarget: "umd"
}
};