-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
48 lines (46 loc) · 1.08 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
const fs = require('fs');
const path = require('path');
const { BannerPlugin } = require('webpack');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const DIST = path.resolve('./dist');
const SRC = path.resolve('./src');
const TSCONFIG = path.resolve('./tsconfig.json');
module.exports = {
mode: process.env.NODE_ENV.replace('test', 'development'),
devtool: 'source-map',
context: SRC,
entry: './index.ts',
target: 'node',
output: {
path: DIST,
filename: 'coinvert',
libraryTarget: 'umd'
},
module: {
rules: [{
test: /\.ts$/,
include: SRC,
loader: 'ts-loader',
options: {
configFile: TSCONFIG,
transpileOnly: true
}
}]
},
resolve: {
extensions: ['.js', '.ts']
},
plugins: [
new BannerPlugin({
banner: '#!/usr/bin/env node',
raw: true
}),
new ForkTsCheckerWebpackPlugin({
tsconfig: '../tsconfig.json',
tslint: '../tslint.json'
}),
function chownBundle() {
this.plugin('done', () => fs.chmodSync('dist/coinvert', '755'));
}
]
};