swagger-api / swagger-api/swagger-codegen

[typescript-fetch] Use ES2015 for typescript compiling

Open
#8,250 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Better to use ES2015 typescript compiling module for webpack/rollup.js import optimization.

Swagger-codegen version

2.3.1

Swagger declaration file content or url

https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/typescript-fetch/package.mustache

Command line used for generation

N/A

Steps to reproduce

N/A

Related issues/PRs

N/A

Suggest a fix/enhancement

My suggestion is adding module and jsnext:main in package.json point to the new file used es2015. ( like this: https://github.com/rollup/rollup/wiki/pkg.module )

Remaining the main points to the file used commonjs, we can use it same as before.

{
  ...
  "main": "./dist/index.js",
  "module": "./es/index.js",
  "jsnext:main": "./es/index.js",
  "typings": "./dist/index.d.ts",
  "scripts" : {
    "build": "tsc --outDir dist/",
    "build:es2015": "tsc --outDir es/ --module ES2015",
    "prepublishOnly": "npm run build && npm run build:es2015"
  }
  ...
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the typescript-fetch package.mustache template linked in the issue and review how its package metadata and build scripts are generated. Verify that CommonJS remains the main output while an ES2015 build is exposed through module and jsnext:main; done means the generated package includes both outputs and the corresponding scripts.

Written by the indexing model from the issue text.

Assessment

Tech stack
rollup, typescript, webpack
Domain
build-system, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.