mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Update transpilation example to Babel 6 and remove system.js
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
Hello
|
Hello
|
||||||
|
|
||||||
@section scripts {
|
@section scripts {
|
||||||
<script src="lib/system.js"></script>
|
<script src='js/main.js'></script>
|
||||||
<script>System.import('js/main.js');</script>
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"name": "ES2015Example",
|
"name": "ES2015Example",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-core": "^5.8.29"
|
"babel-core": "^6.7.4",
|
||||||
|
"babel-preset-es2015": "^6.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ var babelCore = require('babel-core');
|
|||||||
module.exports = function(cb, physicalPath, requestPath) {
|
module.exports = function(cb, physicalPath, requestPath) {
|
||||||
var originalContents = fs.readFileSync(physicalPath);
|
var originalContents = fs.readFileSync(physicalPath);
|
||||||
var result = babelCore.transform(originalContents, {
|
var result = babelCore.transform(originalContents, {
|
||||||
|
presets: ['es2015'],
|
||||||
sourceMaps: 'inline',
|
sourceMaps: 'inline',
|
||||||
sourceFileName: '/sourcemapped' + requestPath
|
sourceFileName: '/sourcemapped' + requestPath
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
export default class Greeting {
|
|
||||||
getMessage() {
|
|
||||||
return 'Hello from the ES2015 class';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
import Greeting from './greeting.js';
|
class Greeting {
|
||||||
|
getMessage() {
|
||||||
|
return 'Hello from the ES2015 class';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log(new Greeting().getMessage());
|
console.log(new Greeting().getMessage());
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user