Skip to content

[Typescript-fetch] url.URLSearchParams is not a constructor #6403

@Place1

Description

@Place1
Description

The typescript-fetch client using swagger 2.3.0 uses import * as url from 'url' which is a native node_module.

I'm using webpack to to bundle my application and it's using node-libs-browser to substitute native node modules for browser compatible ones, including the url module.

The url module is being pulled in through webpack:
webpack --> escope --> node-libs-browser --> url

Are we suppose to import a pollyfill to use this generator? I'd hope not :(

Swagger-codegen version

2.3.0. I'm not sure if this is a regression as there was intentional breaking changes in this version. I also believe this version introduced the dependency on the 'url' module.

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

My solution would be to not use native node modules given the typescript/fetch generator is supposed to work in the browser as well.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions