Closed chaos1ee closed 4 years ago
I have tried swagger-parser in vue-cli project, and it running successfully. I think this issue can be due to some configs in angular-cli.
This problem caused by node polyfils had been removed since angular-cli 6.x.
It looks like you're using Webpack to bundle Swagger Parser for running in a browser. So you'll need to configure Webpack and/or Babel and whatever polyfills are needed for your target environment. See the browser support topic in the ReadMe for details.
Add the flowing codes in "polyfills.ts" can resolve this problem. I have tested, it works.
import * as process from 'process';
(window as any).global = window;
(window as any).process = process;
// @ts-ignore
(window as any).Buffer = window.Buffer || require('buffer').Buffer;
Hi, I'm using swagger-parser in project created by angular-cli, and encountered the following error.
I just wonder if this package supported in browser.