mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-29 12:03:44 +03:00
Do not minify bundle.lib
This commit is contained in:
parent
adfc5e58c5
commit
64471c649a
|
@ -17,7 +17,7 @@
|
||||||
"cy:open": "cypress open",
|
"cy:open": "cypress open",
|
||||||
"bundle:clean": "rimraf bundles",
|
"bundle:clean": "rimraf bundles",
|
||||||
"bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod",
|
"bundle:standalone": "webpack -p --env.lib --env.standalone --env.prod",
|
||||||
"bundle:lib": "webpack -p --env.lib --env.prod",
|
"bundle:lib": "webpack --env.lib",
|
||||||
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
|
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
|
||||||
"stats": "webpack -p --env.lib --env.standalone --env.prod --json --profile > stats.json",
|
"stats": "webpack -p --env.lib --env.standalone --env.prod --json --profile > stats.json",
|
||||||
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\""
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
import * as webpack from 'webpack';
|
import * as webpack from 'webpack';
|
||||||
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
|
import * as HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||||
import * as nodeExternals from 'webpack-node-externals';
|
|
||||||
|
const nodeExternals = require('webpack-node-externals')({
|
||||||
|
// bundle in moudules that need transpiling + non-js (e.g. css)
|
||||||
|
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i],
|
||||||
|
});
|
||||||
|
|
||||||
export default env => {
|
export default env => {
|
||||||
env = env || {};
|
env = env || {};
|
||||||
|
@ -105,10 +109,11 @@ export default env => {
|
||||||
config.output!.libraryTarget = 'umd';
|
config.output!.libraryTarget = 'umd';
|
||||||
|
|
||||||
if (!env.standalone) {
|
if (!env.standalone) {
|
||||||
config.externals = nodeExternals({
|
config.externals = (context, request, callback) => {
|
||||||
// bundle in moudules that need transpiling + non-js (e.g. css)
|
// ignore node-fetch dep of swagger2openapi as it is not used
|
||||||
whitelist: ['swagger2openapi', 'reftools', /\.(?!(?:jsx?|json)$).{1,5}$/i],
|
if (/node-fetch$/i.test(request)) return callback(null, 'var fetch');
|
||||||
});
|
return nodeExternals(context, request, callback);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
config.plugins!.push(
|
config.plugins!.push(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user