swagger-api / swagger-api/swagger-codegen
Using javascript generated package with React result in error during react build
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am trying to use a javascript package, generated through swagger editor, in a react application and i get the following error :
"Cannot find module: 'ApiClient'. Make sure this package is installed."
the error is generated when react builds the sr/index.js file of the package.
the package works fine when used with browserify.
Swagger-codegen version
The version used is the one used by swagger-editor latest release : 2.4.15
Swagger declaration file content or url
The yaml content does not trigger a code generation error. Only the generated code does not seem to be compatible with react
Command line used for generation
Generated through swagger-editor
Steps to reproduce
Generate any package and try to bundle in a react aplpication
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the generated src/index.js package entry point and compare how it is bundled by React with how the same package works through browserify. Reproduce using a package generated through Swagger Editor with swagger-codegen 2.4.15, then identify what causes React's build to report that it cannot find ApiClient. Done means the generated package builds successfully in a React application.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100