Skip to content
Snippets Groups Projects
Commit 0da58e1d authored by Thomas Fritsch's avatar Thomas Fritsch
Browse files

B.2. Compiler avec Babel

parent 2bc13044
No related branches found
No related tags found
No related merge requests found
{
"presets": ["@babel/env"]
"presets": ["@babel/env"],
"plugins": ["@babel/plugin-proposal-class-properties"]
}
\ No newline at end of file
......@@ -20,4 +20,15 @@ const data = [
prix_grande: 8,
image: 'https://images.unsplash.com/photo-1458642849426-cfb724f15ef7?fit=crop&w=500&h=300'
}
];
\ No newline at end of file
];
class Animal {
constructor( name ){
this.name = name;
}
fly() { // déclaration de méthode
console.log(`${this.name} is flying !`);
}
}
const threeEyedRaven = new Animal( 'Bran' );
threeEyedRaven.fly();
\ No newline at end of file
......@@ -136,6 +136,20 @@
"semver": "^5.5.0"
}
},
"@babel/helper-create-class-features-plugin": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.3.tgz",
"integrity": "sha512-qmp4pD7zeTxsv0JNecSBsEmG1ei2MqwJq4YQcK3ZWm/0t07QstWfvuV/vm3Qt5xNMFETn2SZqpMx2MQzbtq+KA==",
"dev": true,
"requires": {
"@babel/helper-function-name": "^7.8.3",
"@babel/helper-member-expression-to-functions": "^7.8.3",
"@babel/helper-optimise-call-expression": "^7.8.3",
"@babel/helper-plugin-utils": "^7.8.3",
"@babel/helper-replace-supers": "^7.8.3",
"@babel/helper-split-export-declaration": "^7.8.3"
}
},
"@babel/helper-create-regexp-features-plugin": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.8.3.tgz",
......@@ -347,6 +361,16 @@
"@babel/plugin-syntax-async-generators": "^7.8.0"
}
},
"@babel/plugin-proposal-class-properties": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz",
"integrity": "sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA==",
"dev": true,
"requires": {
"@babel/helper-create-class-features-plugin": "^7.8.3",
"@babel/helper-plugin-utils": "^7.8.3"
}
},
"@babel/plugin-proposal-dynamic-import": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz",
......
......@@ -4,15 +4,16 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel js -d build",
"watch": "babel js -d build --verbose --watch --source-maps"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel js -d build",
"watch": "babel js -d build --verbose --watch --source-maps"
},
"author": "thomas.fritsch@univ-lille.fr",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.8.4",
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.8.4"
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment