forked from schowdhuri/round-half-even
/
webpack.config.js
41 lines (39 loc) · 1.06 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
const path = require("path");
const fs = require('fs-extra');
class CopyToDemoPlugin {
apply(compiler) {
compiler.hooks.afterEmit.tap('CopyToDemoPlugin', function (compilation) {
const source = './dist/round-half-even.min.js';
const dest = './docs/round-half-even.min.js';
fs.copy(source, dest, function (err) {
if (err) {
return console.error(err);
}
console.log('Copied to ' + dest);
});
});
}
}
module.exports = {
entry: "./src/index.ts",
mode: "production",
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
module: {
rules: [
{
test: /\.ts?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
output: {
filename: "round-half-even.min.js",
path: path.resolve(__dirname, "dist"),
library: "roundHalfEven",
libraryTarget: "umd"
},
plugins: [new CopyToDemoPlugin()],
};