2016-08-28 21:46:10 +03:00
|
|
|
const webpack = require('webpack');
|
|
|
|
|
|
|
|
const VERSION = JSON.stringify(require('../package.json').version);
|
|
|
|
|
|
|
|
const root = require('./helpers').root;
|
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2016-08-30 19:53:06 +03:00
|
|
|
const BANNER =
|
|
|
|
`ReDoc - OpenAPI/Swagger-generated API Reference Documentation
|
|
|
|
-------------------------------------------------------------
|
|
|
|
Version: ${VERSION}
|
|
|
|
Repo: https://github.com/Rebilly/ReDoc`;
|
2016-08-28 21:46:10 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
context: root(),
|
2016-09-02 23:24:51 +03:00
|
|
|
devtool: 'source-map',
|
2016-08-28 21:46:10 +03:00
|
|
|
|
|
|
|
resolve: {
|
2016-09-02 23:24:51 +03:00
|
|
|
extensions: ['', '.ts', '.js', '.json', '.css'],
|
2016-08-28 21:46:10 +03:00
|
|
|
root: root('lib'),
|
2016-09-02 23:24:51 +03:00
|
|
|
modulesDirectories: ['node_modules'],
|
2016-08-28 21:46:10 +03:00
|
|
|
alias: {
|
|
|
|
http: 'stream-http',
|
|
|
|
https: 'stream-http'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
externals: {
|
2016-09-02 23:24:51 +03:00
|
|
|
'jquery': 'jQuery',
|
|
|
|
'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",
|
|
|
|
global: "window",
|
|
|
|
process: true,
|
|
|
|
module: false,
|
|
|
|
clearImmediate: false,
|
|
|
|
setImmediate: false
|
2016-08-28 21:46:10 +03:00
|
|
|
},
|
|
|
|
entry: {
|
|
|
|
'redoc': ['./lib/polyfills.ts', './lib/vendor.ts', './lib/index.ts']
|
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
|
|
|
path: root('dist'),
|
|
|
|
filename: '[name].min.js',
|
|
|
|
sourceMapFilename: '[name].min.map',
|
|
|
|
library: 'Redoc',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
umdNamedDefine: true
|
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
2016-08-29 07:35:47 +03:00
|
|
|
preLoaders: [{
|
|
|
|
test: /\.js$/,
|
2016-09-02 23:24:51 +03:00
|
|
|
loader: 'source-map-loader',
|
|
|
|
exclude: [
|
|
|
|
/node_modules/
|
|
|
|
]
|
2016-08-29 07:35:47 +03:00
|
|
|
}],
|
2016-08-28 21:46:10 +03:00
|
|
|
loaders: [{
|
|
|
|
test: /\.ts$/,
|
|
|
|
loader: 'awesome-typescript-loader',
|
|
|
|
exclude: /(node_modules)/
|
|
|
|
}, {
|
|
|
|
test: /\.css$/,
|
|
|
|
loaders: ['style', 'css?-import']
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
new webpack.LoaderOptionsPlugin({
|
|
|
|
minimize: true,
|
|
|
|
debug: false
|
|
|
|
}),
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
warnings: false,
|
|
|
|
screw_ie8: true
|
|
|
|
},
|
|
|
|
mangle: { screw_ie8 : true },
|
|
|
|
output: {
|
|
|
|
comments: false
|
|
|
|
},
|
2016-08-29 07:35:47 +03:00
|
|
|
sourceMap: true
|
2016-08-28 21:46:10 +03:00
|
|
|
}),
|
2016-08-30 19:53:06 +03:00
|
|
|
new webpack.BannerPlugin(BANNER),
|
2016-08-28 21:46:10 +03:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'IS_PRODUCTION': true,
|
|
|
|
'LIB_VERSION': VERSION
|
|
|
|
})
|
|
|
|
],
|
|
|
|
}
|