-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
38 lines (36 loc) · 1.01 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
const path = require('path');
const BannerPlugin = require('webpack').BannerPlugin;
const ChmodWebpackPlugin = require('chmod-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const resolve = (dir) => path.join(__dirname, dir);
/** @type {import('webpack').Configuration} */
module.exports = {
mode: 'production',
devtool: false,
target: 'node',
entry: { index: resolve('src/index.js') },
output: {
path: resolve('dist'),
filename: 'index.js'
},
module: {
rules: [
{
test: /\.dat$/i,
use: [
{
loader: 'url-loader',
options: { esModule: false }
}
]
}
]
},
plugins: [
new CleanWebpackPlugin(),
new BannerPlugin({ banner: '#!/usr/bin/env node', raw: true }),
new ChmodWebpackPlugin([{ path: resolve('dist/index.js'), mode: 755 }])
// new BundleAnalyzerPlugin()
]
};