Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(babel): use loose mode #33

Merged
merged 1 commit into from
Feb 7, 2018
Merged

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Feb 7, 2018

fixes #32

What:

loose mode for babel transforms

Why:

shorter, more optimized output code

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

require.resolve('babel-plugin-transform-class-properties'),
require.resolve('babel-plugin-transform-object-rest-spread'),
require.resolve('babel-plugin-minify-dead-code-elimination'),
!treeshake
? require.resolve('babel-plugin-transform-es2015-modules-commonjs')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modules-commonjs also has a loose mode, but i dont think its worth using as it breaks namespace imports

import * as namespace from './namespace'

in loose namespace would have enumerable __esModule property which can surprise quite a bit when spreading a namespace

@codecov
Copy link

codecov bot commented Feb 7, 2018

Codecov Report

Merging #33 into master will decrease coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #33      +/-   ##
==========================================
- Coverage   72.86%   72.78%   -0.09%     
==========================================
  Files          21       21              
  Lines         328      327       -1     
  Branches       79       78       -1     
==========================================
- Hits          239      238       -1     
  Misses         66       66              
  Partials       23       23
Impacted Files Coverage Δ
src/config/babelrc.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18730c0...1e76c55. Read the comment docs.

const envTargets = isTest
? {node: 'current'}
: isWebpack || isRollup ? {browsers: ['ie 10', 'ios 7']} : {node: '4.5'}
const envOptions = Object.assign({}, envModules, {targets: envTargets})
const envOptions = {modules: false, loose: true, targets: envTargets}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... We only want {modules: false} if treeshake is true right?

Copy link
Contributor Author

@Andarist Andarist Feb 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im adding transform-es2015-commonjs "by hand" few line below, please check out this comment

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I somehow missed that. Looks good!

@kentcdodds kentcdodds merged commit 65389e4 into kentcdodds:master Feb 7, 2018
@Andarist Andarist deleted the loose branch February 7, 2018 17:21
layershifter pushed a commit to layershifter/kcd-scripts that referenced this pull request Mar 29, 2021
…igin` (kentcdodds#33)

* feat(transform): add support for `rotate` functions and `transform-origin`

* fix(utils): add alias for `calculateNewTranslate` for backwards compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loose mode by default
2 participants