redoc/build/webpack.test.js

68 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-08-28 21:46:10 +03:00
const webpack = require('webpack');
const root = require('./helpers').root;
2017-03-15 18:51:04 +03:00
const path = require('path');
2016-08-28 21:46:10 +03:00
const webpackMerge = require('webpack-merge'); // used to merge webpack configs
const commonConfig = require('./webpack.common.js');
2016-08-28 21:46:10 +03:00
module.exports = webpackMerge(commonConfig({
IS_PRODUCTION: true,
AOT: false
}), {
2016-08-28 21:46:10 +03:00
devtool: 'inline-source-map',
module: {
exprContextCritical: false,
rules: [
{
2016-08-28 21:46:10 +03:00
test: /\.ts$/,
use: 'awesome-typescript-loader'
},
{
2016-08-28 21:46:10 +03:00
test: /\.ts$/,
use: [
'angular2-template-loader',
2016-08-28 21:46:10 +03:00
],
exclude: [/\.(spec|e2e)\.ts$/]
},
{
2016-08-28 21:46:10 +03:00
/**
* Instruments JS files with Istanbul for subsequent code coverage reporting.
* Instrument only testing sources.
*
* See: https://github.com/deepsweet/istanbul-instrumenter-loader
*/
2016-09-27 09:03:04 +03:00
enforce: 'post',
test: /\.(js|ts)$/, loader: 'istanbul-instrumenter-loader',
include: root('lib'),
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/
]
}]
2016-08-28 21:46:10 +03:00
},
plugins: [
2016-09-27 09:03:04 +03:00
new webpack.LoaderOptionsPlugin({
test: /\.ts$/,
sourceMap: false,
inlineSourceMap: true,
removeComments: true,
module: "commonjs"
}),
2016-08-29 12:05:44 +03:00
// ignore changes during tests
new webpack.WatchIgnorePlugin([
/[\\\/]ReDoc$/i, // ignore change of ReDoc folder itself
/node_modules[\\\/].*$/,
/\.tmp[\\\/].*$/,
/dist[\\\/].*$/,
/(?:[^\\\/]*(?:[\\\/]|$))*[^\\\/]*\.css$/ // ignore css files
2017-03-15 18:51:04 +03:00
]),
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
path.resolve(__dirname, '../src')
)
2016-08-28 21:46:10 +03:00
],
})