-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
51 lines (47 loc) · 1.11 KB
/
webpack.config.js
File metadata and controls
51 lines (47 loc) · 1.11 KB
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
//@ts-check
'use strict';
const path = require('path');
const { DefinePlugin, BannerPlugin } = require('webpack');
/**@type {import('webpack').Configuration}*/
const config = {
target: 'node',
mode: 'production',
entry: './src/index.ts',
optimization: {
minimize: false,
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
},
devtool: 'nosources-source-map',
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
},
],
},
],
},
plugins: [
new DefinePlugin({
__GOOGLE_ANALYTICS_ID__: process.env.GOOGLE_ANALYTICS_ID ?
// This is a code injection, so it needs to be defined as a string with the quotes
`\'${process.env.GOOGLE_ANALYTICS_ID}\'` :
undefined,
__ENVIRONMENT__: process.env.ENVIRONMENT ?
`\'${process.env.ENVIRONMENT}\'` :
'\'dev\''
}),
new BannerPlugin({ banner: '#!/usr/bin/env node', raw: true })
],
};
module.exports = config;