-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
57 lines (54 loc) · 1.63 KB
/
webpack.config.ts
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
55
56
57
import { resolve } from 'path';
// eslint-disable-next-line import/no-extraneous-dependencies
import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin';
import webpack from 'webpack';
import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
// eslint-disable-next-line no-underscore-dangle
const __DEV__ = process.env.NODE_ENV === 'development';
const ROOT_DIR = resolve(__dirname, 'src');
const config: webpack.Configuration & { devServer: WebpackDevServerConfiguration } = {
mode: __DEV__ ? 'development' : 'production',
devtool: __DEV__ ? 'inline-source-map' : 'hidden-source-map',
entry: './src/webrtc-private-ip.ts',
output: {
filename: 'webrtc-private-ip.js',
path: resolve(__dirname, 'dist'),
libraryTarget: 'umd',
devtoolNamespace: '', // for making links clickable in WebStorm Karma
},
resolve: {
extensions: ['.ts', '.js'],
modules: [ROOT_DIR, 'node_modules'],
alias: {
'@': ROOT_DIR,
},
plugins: [new TsconfigPathsPlugin()],
},
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
// ignore errors on test files to speed development - will be picked up by linting later
reportFiles: ['!src/**/*.test.ts'],
},
},
],
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: null,
exclude: [/node_modules/],
test: /\.ts($|\?)/i,
}),
],
devServer: {
contentBase: resolve(__dirname, 'public'),
compress: true,
port: 9000,
open: true,
},
};
// eslint-disable-next-line import/no-default-export
export default config;