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

Update to babel 7 ? #846

Closed
Jule- opened this issue Mar 14, 2018 · 9 comments · Fixed by #929
Closed

Update to babel 7 ? #846

Jule- opened this issue Mar 14, 2018 · 9 comments · Fixed by #929

Comments

@Jule-
Copy link

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
Copy link
Contributor

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

@Jule-
Copy link
Author

Jule- commented Mar 14, 2018

Yes if nothing is already planned. Maybe tomorrow.

@arabsight
Copy link

babel 7 is still in beta

@Jule-
Copy link
Author

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
Copy link
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
Copy link
Contributor

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
Copy link

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-
Copy link
Author

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
Copy link

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 }]
];

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 a pull request may close this issue.

6 participants