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

Update to babel 7 ? #846

Closed
Jule- opened this Issue Mar 14, 2018 · 9 comments

Comments

Projects
None yet
6 participants
@Jule-

Jule- commented Mar 14, 2018

Is there any plan to update aurelia-cli to babel 7 soon?

It seems that these 2 requires messed transpilation when we want to use new babel version:

cli/lib/project.js

Lines 207 to 218 in 15b1f1f

function installBabel() {
require('babel-polyfill');
require('babel-register')({
plugins: [
'transform-es2015-modules-commonjs'
],
ignore: (filename) => {
let relativeFromProjectRoot = path.relative(this.directory, filename);
return !/^aurelia_project/.test(relativeFromProjectRoot);
}
});
}

And it seems that this transformation do the trick:

function installBabel() {
  require('@babel/polyfill');
  require('@babel/register')({
    plugins: [
      '@babel/plugin-transform-modules-commonjs'
    ],
    ignore: [(filename) => {
      let relativeFromProjectRoot = path.relative(this.directory, filename);
      return !/^aurelia_project/.test(relativeFromProjectRoot);
    }]
  });
}

This will allow us to use improvements of @babel/preset-env in a local .babelrc file.

@Alexander-Taran

This comment has been minimized.

Member

Alexander-Taran commented Mar 14, 2018

Would you like to provide a pull request for it @Jule- ?

@Jule-

This comment has been minimized.

Jule- commented Mar 14, 2018

Yes if nothing is already planned. Maybe tomorrow.

@arabsight

This comment has been minimized.

arabsight commented Mar 14, 2018

babel 7 is still in beta

@Jule-

This comment has been minimized.

Jule- commented Mar 14, 2018

Indeed but at least I want to migrate to new babel repo (@babel/*), removing warnings, and maybe wait for the release before switching to babel 7?

@bigopon

This comment has been minimized.

Member

bigopon commented Mar 14, 2018

Babel 7 has several upgrades, regard to spec changes. One of that is the decorator proposal spec upgrade. Aurelia current decorator implementation is based on old version of that, and probably won't work well together with Babel 7. I'm not sure what our strategy towards this change is @EisenbergEffect

@EisenbergEffect

This comment has been minimized.

Member

EisenbergEffect commented Mar 14, 2018

A couple of weeks ago there was a meeting with Yahuda, who is working on the decorators spec, and the major framework leaders. I'm completely up to speed about where decorators is at now :) The new spec looks very good and is poised to move into stage 3. At that point, we'll probably see transpiler and polyfill implementations. During that meeting we also talked about compatibility layers for transpiler migration. I think we'll probably wait for that to happen before we make any moves. Otherwise, it's a major breaking change to update our implementations. For vNext we can start from day 1 with the new spec.

@aicokleinovink

This comment has been minimized.

aicokleinovink commented Apr 21, 2018

So yesterday I wanted to upgrade to Babel 7 (because of Typescript support), but if I'm correct that won't work at the moment?? Because of the decorators getting transpiled differently?

@Jule-

This comment has been minimized.

Jule- commented Apr 23, 2018

@aicokleinovink for what I have understood, you are right! It seems that there is possible implementation conflicts between aurelia and babel decorators.

@arabsight

This comment has been minimized.

arabsight commented Jul 2, 2018

you can use the legacy option with the new plugin, and if you're using class-properties then the decorators plugin must come before class-properties pluginn and the later must must use loose mode:

const plugins = [
  ['@babel/plugin-proposal-decorators', { legacy: true }],
  ['@babel/plugin-proposal-class-properties', { loose: true }]
];

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

feat: upgrade to babel7
Still compatible with existing apps in babel6. Also updated dependencies to latest version.

closes aurelia#846

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

feat: upgrade to babel7
Still compatible with existing apps in babel6. Also updated dependencies to latest version.

closes aurelia#846

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 11, 2018

feat: upgrade to babel7
Still compatible with existing apps in babel6. Also updated dependencies to latest version.

closes aurelia#846
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment