-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
56 lines (49 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
55
56
var path = require("path");
var webpack = require("webpack");
var packageConf = require("./package.json");
var WEBPACK_WATCH = process.env.WEBPACK_WATCH || null;
var config = {
entry: {
'index': './src/index.ts',
},
output: {
publicPath: 'dist/',
filename: "[name].js",
path: __dirname + "/dist",
sourceMapFilename: "[name].sourcemap.js",
library: 'pg-face',
libraryTarget: 'umd'
},
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'.
{ test: /\.tsx?$/, loader: "ts-loader" },
{ enforce: "pre", test: /\.js$/, loader: "source-map-loader" }
]
},
plugins: [],
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"]
},
externals: {
// fill with peer dependencies from package.json
},
watch: WEBPACK_WATCH === 'true'
};
for (var peerDependency of Object.keys(packageConf.peerDependencies)) {
config.externals[peerDependency] = peerDependency;
}
function DtsBundlePlugin() {}
DtsBundlePlugin.prototype.apply = function(compiler) {
compiler.plugin('done', function() {
var dts = require('dts-bundle');
dts.bundle({
name: 'index',
main: 'dist/dist/index.d.ts',
out: '../index.d.ts',
outputAsModuleFolder: true
});
});
};
config.plugins.push(new DtsBundlePlugin());
module.exports = config;