Skip to content

Commit

Permalink
feat!: raises the target floor for compiled Javascript to ES6
Browse files Browse the repository at this point in the history
BREAKING CHANGE

All evergreen browsers fully support the ES6 spec (Even Safari as of Safari 10)

Generating ES5 compliant code introduces unnecessary language polyfills that can bloat bundles and possibly create warnings in rollup (no top level this for example).

Since this library supports React 18 and React 18 no longer supports IE 11 this seems like a good time to raise the floor of the non-ESNext generated code.

If users of this library need to support IE 11 still they can always include this library in their babel config to transpile it down to whatever ES version they need to support.
  • Loading branch information
wesgro authored and xobotyi committed Jan 2, 2023
1 parent 371b24e commit 30b79be
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ transpile your `node-modules` in order to run in IE.
This package provides three levels of compilation:

1. **Main**, the `/cjs` folder — CommonJS modules, with ES5 lang level.
2. **ESM**, the `/esm` folder — ES modules (browser compatible), with ES5 lang level.
3. **ESNext**, the `/esnext` folder — ES modules (browser compatible), with ESNext lang level.
2. **ESM**, the `/esm` folder — it is ES modules (browser compatible), with ES5 lang level.
3. **ESNext**, the `/esnext` folder — it is ES modules (browser compatible), with ESNext lang level.

So, if you need the `useMountEffect` hook, depending on your needs, you can import it in three ways
(there are actually more, but these are the three most common):
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"commit": "git-cz",
"build": "yarn build:cleanup && concurrently yarn:build:cjs yarn:build:esm yarn:build:esnext --kill-others-on-fail",
"build:cleanup": "rimraf ./cjs ./esm ./esnext ./types",
"build:cjs": "ttsc -p ./tsconfig.build.json --module CommonJS --target ES5 --outDir ./cjs",
"build:esm": "ttsc -p ./tsconfig.build.json --module ES6 --target ES5 --outDir ./esm",
"build:cjs": "ttsc -p ./tsconfig.build.json --module CommonJS --target ES6 --outDir ./cjs",
"build:esm": "ttsc -p ./tsconfig.build.json --module ES6 --target ES6 --outDir ./esm",
"build:esnext": "ttsc -p ./tsconfig.build.json --module ESNext --target ESNext --outDir ./esnext",
"new-hook": "node ./utility/add-new-hook.js",
"test": "jest --selectProjects dom ssr",
Expand Down
4 changes: 2 additions & 2 deletions src/__docs__/Introduction.story.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ transpile your `node-modules` in order to run in IE.
This package provides three levels of compilation:

1. **Main**, the `/cjs` folder — CommonJS modules, with ES5 lang level.
2. **ESM**, the `/esm` folder — ES modules (browser compatible), with ES5 lang level.
3. **ESNext**, the `/esnext` folder — ES modules (browser compatible), with ESNext lang level.
2. **ESM**, the `/esm` folder — it is ES modules (browser compatible), with ES5 lang level.
3. **ESNext**, the `/esnext` folder — it is ES modules (browser compatible), with ESNext lang level.

So, if you need the `useMountEffect` hook, depending on your needs, you can import it in three ways
(there are actually more, but these are the three most common):
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noEmit": false,
"outDir": "./cjs",
"declaration": true,
"target": "ES5",
"target": "ES6",
"module": "CommonJS",
"moduleResolution": "Node",
"sourceMap": false,
Expand Down

0 comments on commit 30b79be

Please sign in to comment.