-
Notifications
You must be signed in to change notification settings - Fork 51
/
webpack.config.js
69 lines (66 loc) · 2.42 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
57
58
59
60
61
62
63
64
65
66
67
68
69
const path = require('path')
const TerserPlugin = require('terser-webpack-plugin')
module.exports = (env, argv) => {
const isProduction = argv.mode === 'production'
const isWatch = argv.watch || false
return {
mode: isProduction ? 'production' : 'development',
watch: isWatch,
entry: {
index: './src/js/index.ts',
accordion: './src/js/plugins/accordion/index.ts',
carousel: './src/js/plugins/carousel/index.ts',
collapse: './src/js/plugins/collapse/index.ts',
combobox: './src/js/plugins/combobox/index.ts',
'copy-markup': './src/js/plugins/copy-markup/index.ts',
datatable: './src/js/plugins/datatable/index.ts',
dropdown: './src/js/plugins/dropdown/index.ts',
'file-upload': './src/js/plugins/file-upload/index.ts',
'input-number': './src/js/plugins/input-number/index.ts',
overlay: './src/js/plugins/overlay/index.ts',
'pin-input': './src/js/plugins/pin-input/index.ts',
'range-slider': './src/js/plugins/range-slider/index.ts',
'remove-element': './src/js/plugins/remove-element/index.ts',
scrollspy: './src/js/plugins/scrollspy/index.ts',
select: './src/js/plugins/select/index.ts',
stepper: './src/js/plugins/stepper/index.ts',
'strong-password': './src/js/plugins/strong-password/index.ts',
tabs: './src/js/plugins/tabs/index.ts',
'toggle-count': './src/js/plugins/toggle-count/index.ts',
'toggle-password': './src/js/plugins/toggle-password/index.ts',
tooltip: './src/js/plugins/tooltip/index.ts',
'tree-view': './src/js/plugins/tree-view/index.ts',
// Helpers
'helper-apexcharts': './src/js/helpers/apexcharts/index.ts',
'helper-clipboard': './src/js/helpers/clipboard/index.ts'
},
module: {
rules: [
{ test: /\.ts?$/, enforce: 'pre', use: ['source-map-loader'] },
{ test: /\.ts?$/, use: 'ts-loader', exclude: /node_modules/ }
]
},
resolve: { extensions: ['.ts', '.js'] },
output: {
path: path.resolve(__dirname, 'dist/js/'),
filename: '[name].js',
library: { type: 'umd' }
},
externals: {
jquery: 'jQuery',
lodash: '_',
'datatables.net': 'DataTable',
dropzone: 'Dropzone',
clipboard: 'ClipboardJS',
noUiSlider: 'noUiSlider'
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false
})
]
}
}
}