-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
51 lines (49 loc) · 1.33 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
const webpack = require('webpack')
const slsw = require('serverless-webpack')
const nodeExternals = require('webpack-node-externals')
const RollbarSourceMapPlugin = require('rollbar-sourcemap-webpack-plugin')
const childProcess = require('child_process')
function git (command) {
return childProcess.execSync(`git ${command}`, { encoding: 'utf8' }).trim()
}
module.exports = (async () => {
const version = git('rev-parse --short HEAD')
return {
entry: slsw.lib.entries,
target: 'node',
devtool: 'hidden-source-map',
externals: [nodeExternals()],
mode: slsw.lib.webpack.isLocal ? 'development' : 'production',
performance: {
hints: false
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
module: {
rules: [
{
// Include ts, tsx, js, and jsx files.
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
use: [
'babel-loader'
]
}
]
},
plugins: [
new webpack.EnvironmentPlugin({
SOURCEMAP_VERSION: version
}),
process.env.CI
? new RollbarSourceMapPlugin({
accessToken: process.env.ROLLBAR_ACCESS_TOKEN,
ignoreErrors: true,
publicPath: '/var/task',
version: version
})
: false
].filter(Boolean)
}
})()