mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 01:54:08 +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: {
|
||||
esprima: 'esprima',
|
||||
'node-fetch': 'null',
|
||||
'node-fetch-h2': 'null',
|
||||
yaml: 'null',
|
||||
'safe-json-stringify': 'null',
|
||||
},
|
||||
|
||||
module: {
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
"cy:open": "cypress open",
|
||||
"bundle:clean": "rimraf bundles",
|
||||
"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",
|
||||
"declarations": "tsc --emitDeclarationOnly -p tsconfig.lib.json && cp -R src/types typings/",
|
||||
"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> {
|
||||
console.warn('[ReDoc Compatibility mode]: Converting OpenAPI 2.0 to OpenAPI 3.0');
|
||||
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
|
||||
if (err) {
|
||||
return reject(err);
|
||||
|
|
|
@ -65,13 +65,13 @@ export default (env: { standalone?: boolean } = {}, { mode }) => ({
|
|||
? {
|
||||
esprima: 'esprima',
|
||||
'node-fetch': 'null',
|
||||
'node-fetch-h2': 'null',
|
||||
yaml: 'null',
|
||||
'safe-json-stringify': 'null',
|
||||
}
|
||||
: (context, request, callback) => {
|
||||
// ignore node-fetch dep of swagger2openapi as it is not used
|
||||
if (/node-fetch$/i.test(request)) {
|
||||
return callback(null, 'var undefined');
|
||||
}
|
||||
if (/esprima$/i.test(request)) {
|
||||
if (/esprima|node-fetch|node-fetch-h2|yaml|safe-json-stringify$/i.test(request)) {
|
||||
return callback(null, 'var undefined');
|
||||
}
|
||||
return nodeExternals(context, request, callback);
|
||||
|
|
Loading…
Reference in New Issue
Block a user