-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
52 lines (51 loc) · 1.66 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
const path = require('path');
const WebpackMd5Hash = require('webpack-md5-hash');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const SshWebpackPlugin = require('ssh-webpack-plugin');
module.exports = {
entry: {
server: ['@babel/polyfill', path.resolve(__dirname, './index.js')]
},
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
filename: '[name].bundle.js'
},
target: 'node',
node: {
// Need this when working with express, otherwise the build fails
__dirname: false, // if you don't put this is, __dirname
__filename: false // and __filename return blank or /
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin([
{ from: path.join(__dirname, './package.json'), to: './package.json' }
]),
new CopyWebpackPlugin([
{ from: path.join(__dirname, './ecosystem.config.js'), to: './ecosystem.config.js' }
]),
new SshWebpackPlugin({
host: '5.45.116.160',
port: '22',
username: 'admin',
privateKey: require('fs').readFileSync(path.resolve('../../.ssh', 'id_rsa')),
from: path.join(__dirname, './dist'),
to: '/home/admin/nodomain/radiorecord',
after: 'pm2 restart radiorecord'
}),
new WebpackMd5Hash()
]
};