Update webpack configs + add banner (fixes #89)

This commit is contained in:
Roman Hotsiy 2016-08-30 19:53:06 +03:00
parent a01f9f41a4
commit 7f3bdd1603
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
3 changed files with 18 additions and 12 deletions

View File

@ -3,12 +3,12 @@ const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin
const root = require('./helpers').root;
const VERSION = JSON.stringify(require('../package.json').version);
const IS_PRODUCTION = process.env.NODE_ENV === "production";
// TODO Refactor common parts of config
module.exports = {
context: root(),
devtool: 'cheap-module-source-map',
devtool: 'source-map',
debug: false,
resolve: {
@ -43,22 +43,22 @@ module.exports = {
poll: true
},
port: 9000,
hot: true,
stats: {
modules: false,
cached: false,
chunk: false
}
hot: false,
stats: 'errors-only'
},
output: {
path: root('dist'),
filename: '[name].js',
sourceMapFilename: '[name].map',
sourceMapFilename: '[name].[id].map',
chunkFilename: '[id].chunk.js'
},
module: {
preLoaders: [{
test: /\.js$/,
loader: 'source-map'
}],
loaders: [{
test: /\.ts$/,
loaders: [
@ -89,7 +89,7 @@ module.exports = {
}),
new webpack.DefinePlugin({
'IS_PRODUCTION': false,
'IS_PRODUCTION': IS_PRODUCTION,
'LIB_VERSION': VERSION
}),

View File

@ -4,6 +4,11 @@ const VERSION = JSON.stringify(require('../package.json').version);
const root = require('./helpers').root;
const CopyWebpackPlugin = require('copy-webpack-plugin');
const BANNER =
`ReDoc - OpenAPI/Swagger-generated API Reference Documentation
-------------------------------------------------------------
Version: ${VERSION}
Repo: https://github.com/Rebilly/ReDoc`;
module.exports = {
context: root(),
@ -72,7 +77,7 @@ module.exports = {
},
sourceMap: true
}),
new webpack.BannerPlugin(BANNER),
new webpack.DefinePlugin({
'IS_PRODUCTION': true,
'LIB_VERSION': VERSION

View File

@ -23,7 +23,8 @@
"start": "webpack-dev-server --config build/webpack.dev.js --content-base demo",
"e2e-server": "http-server -p 3000 tests/e2e",
"e2e-copy": "cp dist/redoc.min.js tests/e2e/",
"webdriver": "webdriver-manager update"
"webdriver": "webdriver-manager update",
"serve:prod": "NODE_ENV=production npm start"
},
"keywords": [
"OpenAPI",