-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
54 lines (53 loc) · 1.19 KB
/
webpack.common.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
const webpack = require('webpack');
const path = require('path');
const WebpackShellPlugin = require('webpack-shell-plugin');
const NodeExternals = require('webpack-node-externals');
module.exports = (env) => {
const outputFilename = 'go-music';
const outputPath = path.resolve(__dirname, 'build');
return {
entry: {
main: './src/index.ts'
},
output: {
filename: outputFilename,
path: outputPath
},
target: 'node',
node: false,
module: {
rules: [
{
test: /\.ts$|\.js$/,
use: ['ts-loader', 'typegraphql-description-loader', 'eslint-loader'],
exclude: /node_modules/
},
{
test: /\.sql$/,
use: 'raw-loader',
exclude: /node_modules/
}
]
},
externals: [NodeExternals()],
resolve: {
extensions: [ '.ts', '.js' ],
alias: {
'@': path.resolve(__dirname, 'src/'),
'@G': path.resolve(__dirname, 'globals/')
}
},
plugins: [
new webpack.DefinePlugin({
RELEASE: env && env.release ? env.release : false,
}),
new webpack.BannerPlugin({
banner: '#!/usr/bin/env node',
raw: true,
}),
new WebpackShellPlugin({
onBuildEnd: [`chmod +x ${path.join(outputPath, outputFilename)}`],
})
]
};
};