diff --git a/build/webpack.dev.js b/build/webpack.dev.js index 3f687a21..5ac0c436 100644 --- a/build/webpack.dev.js +++ b/build/webpack.dev.js @@ -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 }), diff --git a/build/webpack.prod.js b/build/webpack.prod.js index edcaf3b2..96c9b71f 100644 --- a/build/webpack.prod.js +++ b/build/webpack.prod.js @@ -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 diff --git a/package.json b/package.json index 1fe7f22d..78415ec0 100644 --- a/package.json +++ b/package.json @@ -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",