jhen0409 / babel-preset-es2015-node6 Goto Github PK
View Code? Open in Web Editor NEWBabel preset to make node@6 fully ES2015 compatible.
License: MIT License
Babel preset to make node@6 fully ES2015 compatible.
License: MIT License
The following, using babel-preset-react
fails without transform-es2015-arrow-functions
:
export default param => class extends Component {
render() {
return <MyComponent />;
}
}
It doesn't compile the JSX.
The package recently moved from 0.3.0
to 0.4.0
but I have no idea why/what? (in fact I have a clue)
Please add a changelog and/or publish you releases (with description) to GitHub: https://github.com/jhen0409/babel-preset-es2015-node6/releases
PS: See how babel is doing https://github.com/babel/babel/releases
FYI
When using es2015-node6 (0.3.0) within another preset using require
:
module.exports = {
presets: [
[require("babel-preset-es2015-node6"), { loose: true }]
]
};
I get the following error :
Error: Options {"loose":true} passed to a preset which does not accept options.
This is working fine :
module.exports = {
presets: [
["es2015-node6", { loose: true }]
]
};
But I still need to use require
for my preset (as described in official doc and in official presets)
Anyone managed to get this preset to work with https://babeljs.io/docs/plugins/transform-object-rest-spread/?
Seems it works fine for spread but doesn't work for rest. I'm guessing I need to install an additional preset. Reported here as well: https://phabricator.babeljs.io/T7316
I'm sure this is just user error or not knowing what other piece I need to add to this to make this work, but this is what i'm getting when i try to use async/await with object super.
.babelrc:
{
"presets": [
"es2015-node6",
"stage-1"
]
}
minimal code to reproduce:
class Master {
async setup() {
console.log('hi');
}
}
class Child extends Master {
async setupChild() {
await super.setup();
}
}
const x = new Child();
x.setupChild();
Compiled code:
'use strict';
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { return step("next", value); }, function (err) { return step("throw", err); }); } } return step("next"); }); }; }
let Master = class Master {
setup() {
return _asyncToGenerator(function* () {
console.log('hi');
})();
}
};
let Child = class Child extends Master {
setupChild() {
return _asyncToGenerator(function* () {
yield super.setup();
})();
}
};
const x = new Child();
x.setupChild();
error:
yield super.setup();
^^^^^
SyntaxError: 'super' keyword unexpected here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.