-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathwebpack.config.js
36 lines (35 loc) · 896 Bytes
/
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
const path = require('path');
const WrapperPlugin = require('wrapper-webpack-plugin');
module.exports = (params = {}) => ({
mode: params.mode || 'development',
entry: './src/index.ts',
output: {
filename: params.filename || 'jgallery.js',
publicPath: 'js/',
library: 'JGallery',
libraryTarget: 'var',
path: path.resolve(__dirname, 'dist', 'js')
},
resolve: {
extensions: ['.ts', '.js']
},
devServer: {
contentBase: 'dist/',
overlay: {
errors: true,
warnings: true
}
},
plugins: [
new WrapperPlugin({
test: /\.js$/,
header: '(function(){',
footer: 'if (typeof window !== "undefined") window.JGallery = JGallery.default; if (typeof module !== "undefined") module.exports = JGallery; })()'
})
],
module: {
rules: [
{ test: /\.ts$/, use: ['ts-loader'], exclude: /node_modules/ },
]
}
});