Skip to content

Commit

Permalink
feat: remove require helper for commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
zzcwoshizz committed May 12, 2023
1 parent f883f9f commit 9d5ab4b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/popular-carrots-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zcloak/dev": minor
---

remove require helper for commonjs
4 changes: 2 additions & 2 deletions packages/dev/config/babel-config-cjs.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const presets = require('./babel-presets.cjs');

module.exports = {
...general,
plugins: plugins(false, false, false),
presets: presets(false, false)
plugins: plugins(false, false),
presets: presets(false)
};
4 changes: 2 additions & 2 deletions packages/dev/config/babel-config-esm.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const presets = require('./babel-presets.cjs');

module.exports = {
...general,
plugins: plugins(true, false, true),
presets: presets(true, false)
plugins: plugins(true, true),
presets: presets(true)
};
4 changes: 2 additions & 2 deletions packages/dev/config/babel-config-webpack.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const presets = require('./babel-presets.cjs');

module.exports = {
...general,
plugins: plugins(true, true, false),
presets: presets(true, true)
plugins: plugins(true, false),
presets: presets(true)
};
5 changes: 2 additions & 3 deletions packages/dev/config/babel-plugins.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@

const resolver = require('./babel-resolver.cjs');

module.exports = function (isEsm, usage, doRewrite) {
module.exports = function (isEsm, doRewrite) {
return resolver([
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-numeric-separator',
'@babel/plugin-proposal-optional-chaining',
[
'@babel/plugin-transform-runtime',
{
corejs: usage ? 3 : false,
helpers: true,
helpers: false,
regenerator: true,
useESModules: isEsm
}
Expand Down
4 changes: 1 addition & 3 deletions packages/dev/config/babel-presets.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

const resolver = require('./babel-resolver.cjs');

module.exports = function (isEsm, usage) {
module.exports = function (isEsm) {
return resolver([
'@babel/preset-typescript',
[
Expand All @@ -16,8 +16,6 @@ module.exports = function (isEsm, usage) {
[
'@babel/preset-env',
{
useBuiltIns: usage ? 'usage' : false,
corejs: usage ? 3 : false,
exclude: [
// we don't want 2n ** 128n to Math.pow(2n, 128n)
'@babel/plugin-transform-exponentiation-operator',
Expand Down

0 comments on commit 9d5ab4b

Please sign in to comment.