mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-07 05:20:32 +03:00
chore: fix bundle after oas-kit update
This commit is contained in:
parent
5297fdf01a
commit
6de3523eb0
|
@ -94,6 +94,9 @@ export default (env: { playground?: boolean; bench?: boolean } = {}, { mode }) =
|
||||||
externals: {
|
externals: {
|
||||||
esprima: 'esprima',
|
esprima: 'esprima',
|
||||||
'node-fetch': 'null',
|
'node-fetch': 'null',
|
||||||
|
'node-fetch-h2': 'null',
|
||||||
|
yaml: 'null',
|
||||||
|
'safe-json-stringify': 'null',
|
||||||
},
|
},
|
||||||
|
|
||||||
module: {
|
module: {
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
"cy:open": "cypress open",
|
"cy:open": "cypress open",
|
||||||
"bundle:clean": "rimraf bundles",
|
"bundle:clean": "rimraf bundles",
|
||||||
"bundle:standalone": "webpack --env.standalone --mode=production",
|
"bundle:standalone": "webpack --env.standalone --mode=production",
|
||||||
"bundle:lib": "webpack --mode=production",
|
"bundle:lib": "webpack --mode=production && npm run declarations",
|
||||||
"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",
|
||||||
"declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json && cp -R src/types typings/",
|
"declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json && cp -R src/types typings/",
|
||||||
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
|
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
|
||||||
|
|
|
@ -19,7 +19,7 @@ export async function loadAndBundleSpec(specUrlOrObject: object | string): Promi
|
||||||
export function convertSwagger2OpenAPI(spec: any): Promise<OpenAPISpec> {
|
export function convertSwagger2OpenAPI(spec: any): Promise<OpenAPISpec> {
|
||||||
console.warn('[ReDoc Compatibility mode]: Converting OpenAPI 2.0 to OpenAPI 3.0');
|
console.warn('[ReDoc Compatibility mode]: Converting OpenAPI 2.0 to OpenAPI 3.0');
|
||||||
return new Promise<OpenAPISpec>((resolve, reject) =>
|
return new Promise<OpenAPISpec>((resolve, reject) =>
|
||||||
convertObj(spec, { patch: true, warnOnly: true }, (err, res) => {
|
convertObj(spec, { patch: true, warnOnly: true, text: '{}' }, (err, res) => {
|
||||||
// TODO: log any warnings
|
// TODO: log any warnings
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err);
|
return reject(err);
|
||||||
|
|
|
@ -65,13 +65,13 @@ export default (env: { standalone?: boolean } = {}, { mode }) => ({
|
||||||
? {
|
? {
|
||||||
esprima: 'esprima',
|
esprima: 'esprima',
|
||||||
'node-fetch': 'null',
|
'node-fetch': 'null',
|
||||||
|
'node-fetch-h2': 'null',
|
||||||
|
yaml: 'null',
|
||||||
|
'safe-json-stringify': 'null',
|
||||||
}
|
}
|
||||||
: (context, request, callback) => {
|
: (context, request, callback) => {
|
||||||
// ignore node-fetch dep of swagger2openapi as it is not used
|
// ignore node-fetch dep of swagger2openapi as it is not used
|
||||||
if (/node-fetch$/i.test(request)) {
|
if (/esprima|node-fetch|node-fetch-h2|yaml|safe-json-stringify$/i.test(request)) {
|
||||||
return callback(null, 'var undefined');
|
|
||||||
}
|
|
||||||
if (/esprima$/i.test(request)) {
|
|
||||||
return callback(null, 'var undefined');
|
return callback(null, 'var undefined');
|
||||||
}
|
}
|
||||||
return nodeExternals(context, request, callback);
|
return nodeExternals(context, request, callback);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user