forked from nadchif/html-duration-picker.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
47 lines (46 loc) · 1.34 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
// webpack.config.js
const WebpackAutoInject = require('webpack-auto-inject-version');
const path = require('path');
const CreateFileWebpack = require('create-file-webpack');
module.exports = (env, args) => {
console.log(args.mode);
return {
context: __dirname,
entry: './src/html-duration-picker.js',
output: {
path: args.mode == 'development' ? path.resolve(__dirname, 'src/compiled') : path.resolve(__dirname, 'dist'),
filename: args.mode == 'development' ? 'html-duration-picker.js' : 'html-duration-picker.min.js',
library: 'HtmlDurationPicker',
libraryTarget: 'umd',
libraryExport: 'default',
// umdNamedDefine: true,
globalObject: 'this',
},
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
plugins: ['babel-plugin-remove-template-literals-whitespace'],
}
}
}, ],
},
plugins: [
new WebpackAutoInject({
components: {
AutoIncreaseVersion: true,
InjectAsComment: false,
InjectByTag: true,
},
}),
new CreateFileWebpack({
path: './dist',
fileName: 'html-duration-picker.min.d.ts',
content: `declare module '${process.env.npm_package_name}'`,
}),
],
};
};