Skip to content

Don't apply babel-plugin-transform-runtime inside react-on-rails to work with babel 7#1136

Merged
justin808 merged 2 commits intoshakacode:masterfrom
tricknotes:babel-7
Aug 27, 2018
Merged

Don't apply babel-plugin-transform-runtime inside react-on-rails to work with babel 7#1136
justin808 merged 2 commits intoshakacode:masterfrom
tricknotes:babel-7

Conversation

@tricknotes
Copy link
Copy Markdown
Contributor

@tricknotes tricknotes commented Aug 21, 2018

Don't apply babel-plugin-transform-runtime inside react-on-rails to work with babel@7

It should be applied by user land.

Why?
The generated code depends on built babel's version.
It means that user couldn' build their code with babel@7 that depends on react-on-rails built by babel@6.

For example, babel-plugin-transform-runtime (babel 6) generates the
following code.

var _assign = require('babel-runtime/core-js/object/assign');

However @babel/plugin-transform-runtime (babel 7) expects the
path that beginning of @babel/runtime/.

The change allows to use react-on-rails on babel@7.


This change is Reviewable

…ork with babel@7

It should be applied by user land.

Why?
The generated code depends on built babel's version.
It means that user couldn' build their code with babel@7 that depends on react-on-rails built by babel@6.

For example, babel-plugin-transform-runtime (babel 6) generates the
following code.
``` js
var _assign = require('babel-runtime/core-js/object/assign');
```

However @babel/plugin-transform-runtime (babel 7) expects the
path that beginning of `@babel/runtime/`.

The change allows to use react-on-rails on babel@7.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at ?% when pulling 89819ab on tricknotes:babel-7 into 8920545 on shakacode:master.

@coveralls
Copy link
Copy Markdown

coveralls commented Aug 21, 2018

Coverage Status

Coverage remained the same at ?% when pulling aa974d8 on tricknotes:babel-7 into dc73be5 on shakacode:master.

@justin808
Copy link
Copy Markdown
Member

@tricknotes what about babel@6?

@alexfedoseev any idea on this one?

@justin808 justin808 merged commit de06717 into shakacode:master Aug 27, 2018
tricknotes added a commit to tricknotes/react_on_rails that referenced this pull request Sep 8, 2018
…ils to work with babel@7 (shakacode#1136)"

This reverts commit de06717.

In general, Webpack doesn't build under `node_modules`.
So react-on-rails should support browser compatible build.
@tricknotes tricknotes deleted the babel-7 branch September 8, 2018 17:16
justin808 pushed a commit that referenced this pull request Sep 12, 2018
* Revert "Don't apply babel-plugin-transform-runtime inside react-on-rails to work with babel@7 (#1136)"

This reverts commit de06717.

In general, Webpack doesn't build under `node_modules`.
So react-on-rails should support browser compatible build.

* Specify babel-runtime as dependencies, not as peerDependencies

babel-runtime is not installed Babel 7 environment.
(Babel 7 denpends @babel/runtime.)

So this should be depended as "dependencies".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants