2016-08-28 21:46:10 +03:00
|
|
|
const webpack = require('webpack');
|
|
|
|
|
|
|
|
const root = require('./helpers').root;
|
|
|
|
const VERSION = JSON.stringify(require('../package.json').version);
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
2016-08-29 12:05:44 +03:00
|
|
|
|
2016-08-28 21:46:10 +03:00
|
|
|
devtool: 'inline-source-map',
|
|
|
|
resolve: {
|
2016-09-27 09:03:04 +03:00
|
|
|
extensions: ['.ts', '.js', '.json', '.css'],
|
2016-08-28 21:46:10 +03:00
|
|
|
alias: {
|
|
|
|
http: 'stream-http',
|
|
|
|
https: 'stream-http'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
externals: {
|
2016-10-18 17:06:00 +03:00
|
|
|
'jquery': 'jquery',
|
2016-09-02 23:24:51 +03:00
|
|
|
'esprima': 'esprima' // optional dep of ys-yaml not needed for redoc
|
2016-08-28 21:46:10 +03:00
|
|
|
},
|
|
|
|
node: {
|
2016-09-02 23:24:51 +03:00
|
|
|
fs: "empty",
|
|
|
|
crypto: "empty",
|
2016-09-27 09:03:04 +03:00
|
|
|
global: true,
|
2016-09-02 23:24:51 +03:00
|
|
|
process: true,
|
|
|
|
module: false,
|
|
|
|
clearImmediate: false,
|
|
|
|
setImmediate: false
|
2016-08-28 21:46:10 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
|
|
|
path: root('dist'),
|
|
|
|
filename: '[name].js',
|
|
|
|
sourceMapFilename: '[name].map',
|
|
|
|
chunkFilename: '[id].chunk.js'
|
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
2016-09-28 00:30:33 +03:00
|
|
|
exprContextCritical: false,
|
2016-09-27 09:03:04 +03:00
|
|
|
rules: [{
|
|
|
|
enforce: 'pre',
|
2016-08-29 07:35:47 +03:00
|
|
|
test: /\.js$/,
|
2016-09-02 23:24:51 +03:00
|
|
|
loader: 'source-map-loader',
|
|
|
|
exclude: [
|
|
|
|
/node_modules/
|
|
|
|
]
|
2016-09-27 09:03:04 +03:00
|
|
|
},{
|
2016-08-28 21:46:10 +03:00
|
|
|
test: /\.ts$/,
|
|
|
|
loaders: [
|
|
|
|
'awesome-typescript-loader'
|
2016-09-27 09:03:04 +03:00
|
|
|
]
|
2016-08-28 21:46:10 +03:00
|
|
|
}, {
|
|
|
|
test: /\.ts$/,
|
|
|
|
loaders: [
|
|
|
|
'angular2-template-loader'
|
|
|
|
],
|
|
|
|
exclude: [/\.(spec|e2e)\.ts$/]
|
2016-09-27 09:03:04 +03:00
|
|
|
}, {
|
2016-09-28 00:30:33 +03:00
|
|
|
test: /lib[\\\/].*\.css$/,
|
2016-08-28 21:46:10 +03:00
|
|
|
loaders: ['raw-loader'],
|
|
|
|
exclude: [/redoc-initial-styles\.css$/]
|
2016-09-27 09:03:04 +03:00
|
|
|
}, {
|
2016-08-28 21:46:10 +03:00
|
|
|
test: /\.css$/,
|
2016-11-29 10:20:11 +03:00
|
|
|
loaders: ['style-loader', 'css-loader?-import'],
|
2016-09-28 00:30:33 +03:00
|
|
|
exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
|
2016-09-27 09:03:04 +03:00
|
|
|
}, {
|
2016-08-28 21:46:10 +03:00
|
|
|
test: /\.html$/,
|
|
|
|
loader: 'raw-loader'
|
2016-09-27 09:03:04 +03:00
|
|
|
}, {
|
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: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'IS_PRODUCTION': false,
|
2016-09-28 00:30:33 +03:00
|
|
|
'LIB_VERSION': VERSION,
|
|
|
|
'AOT': 'false'
|
2016-08-28 21:46:10 +03:00
|
|
|
}),
|
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([
|
2016-09-28 00:30:33 +03:00
|
|
|
/[\\\/]ReDoc$/i, // ignore change of ReDoc folder itself
|
|
|
|
/node_modules[\\\/].*$/,
|
|
|
|
/\.tmp[\\\/].*$/,
|
|
|
|
/dist[\\\/].*$/,
|
|
|
|
/(?:[^\\\/]*(?:[\\\/]|$))*[^\\\/]*\.css$/ // ignore css files
|
2016-08-29 12:05:44 +03:00
|
|
|
])
|
2016-08-28 21:46:10 +03:00
|
|
|
],
|
|
|
|
}
|