mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 16:46:34 +03:00
Update webpack configs + add banner (fixes #89)
This commit is contained in:
parent
a01f9f41a4
commit
7f3bdd1603
|
@ -3,12 +3,12 @@ const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin
|
||||||
|
|
||||||
const root = require('./helpers').root;
|
const root = require('./helpers').root;
|
||||||
const VERSION = JSON.stringify(require('../package.json').version);
|
const VERSION = JSON.stringify(require('../package.json').version);
|
||||||
|
const IS_PRODUCTION = process.env.NODE_ENV === "production";
|
||||||
// TODO Refactor common parts of config
|
// TODO Refactor common parts of config
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
context: root(),
|
context: root(),
|
||||||
devtool: 'cheap-module-source-map',
|
devtool: 'source-map',
|
||||||
debug: false,
|
debug: false,
|
||||||
|
|
||||||
resolve: {
|
resolve: {
|
||||||
|
@ -43,22 +43,22 @@ module.exports = {
|
||||||
poll: true
|
poll: true
|
||||||
},
|
},
|
||||||
port: 9000,
|
port: 9000,
|
||||||
hot: true,
|
hot: false,
|
||||||
stats: {
|
stats: 'errors-only'
|
||||||
modules: false,
|
|
||||||
cached: false,
|
|
||||||
chunk: false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
path: root('dist'),
|
path: root('dist'),
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
sourceMapFilename: '[name].map',
|
sourceMapFilename: '[name].[id].map',
|
||||||
chunkFilename: '[id].chunk.js'
|
chunkFilename: '[id].chunk.js'
|
||||||
},
|
},
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
|
preLoaders: [{
|
||||||
|
test: /\.js$/,
|
||||||
|
loader: 'source-map'
|
||||||
|
}],
|
||||||
loaders: [{
|
loaders: [{
|
||||||
test: /\.ts$/,
|
test: /\.ts$/,
|
||||||
loaders: [
|
loaders: [
|
||||||
|
@ -89,7 +89,7 @@ module.exports = {
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'IS_PRODUCTION': false,
|
'IS_PRODUCTION': IS_PRODUCTION,
|
||||||
'LIB_VERSION': VERSION
|
'LIB_VERSION': VERSION
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,11 @@ const VERSION = JSON.stringify(require('../package.json').version);
|
||||||
|
|
||||||
const root = require('./helpers').root;
|
const root = require('./helpers').root;
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
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 = {
|
module.exports = {
|
||||||
context: root(),
|
context: root(),
|
||||||
|
@ -72,7 +77,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
sourceMap: true
|
sourceMap: true
|
||||||
}),
|
}),
|
||||||
|
new webpack.BannerPlugin(BANNER),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'IS_PRODUCTION': true,
|
'IS_PRODUCTION': true,
|
||||||
'LIB_VERSION': VERSION
|
'LIB_VERSION': VERSION
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
"start": "webpack-dev-server --config build/webpack.dev.js --content-base demo",
|
"start": "webpack-dev-server --config build/webpack.dev.js --content-base demo",
|
||||||
"e2e-server": "http-server -p 3000 tests/e2e",
|
"e2e-server": "http-server -p 3000 tests/e2e",
|
||||||
"e2e-copy": "cp dist/redoc.min.js 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": [
|
"keywords": [
|
||||||
"OpenAPI",
|
"OpenAPI",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user