-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.test.js
34 lines (33 loc) · 1.35 KB
/
webpack.test.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
const nodeExternals = require('webpack-node-externals');
const isCoverage = process.env.NODE_ENV === 'coverage';
const path = require('path');
const { CheckerPlugin } = require('awesome-typescript-loader')
module.exports = {
resolve: {
modules: [path.resolve('./src'), "node_modules"],
extensions: ['.ts', '.js'],
},
output: {
// use absolute paths in sourcemaps (important for debugging via IDE)
devtoolModuleFilenameTemplate: '[absolute-resource-path]',
devtoolFallbackModuleFilenameTemplate: '[absolute-resource-path]?[hash]'
},
module: {
rules: [].concat(
isCoverage ? {
test: /\.(js|ts)/,
include: path.resolve('src'), // instrument only testing sources with Istanbul, after ts-loader runs
loader: 'istanbul-instrumenter-loader'
}: [],
{
test: /\.ts$/,
exclude: /(node_modules|bower_components)/,
loader: 'awesome-typescript-loader?sourceMap=true&declaration=false',
}
)
},
plugins: [ new CheckerPlugin() ],
target: 'node', // webpack should compile node compatible code
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
devtool: "#inline-cheap-module-source-map"
};