-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.common.js
39 lines (39 loc) · 1013 Bytes
/
webpack.common.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
const path = require("path");
const webpack = require("webpack");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const pkg = require("./package.json");
module.exports = {
entry: "./src/index",
output: {
path: path.join(__dirname, "dist"),
filename: "index.js",
library: pkg.name,
libraryTarget: "umd"
},
plugins: [
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(pkg.version)
}),
new CleanWebpackPlugin(["build", "dist"], {
root: __dirname
})
],
resolve: {
extensions: [".ts", ".js", ".json"]
},
module: {
rules: [
{
test: /\.(js|ts)x?$/,
loader: "ts-loader",
exclude: [/node_modules/]
},
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader",
exclude: [/node_modules/]
}
]
}
};