mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +00:00
Rename ES2015Transpilation sample to NodeServicesExamples (because will be adding some more examples here)
This commit is contained in:
12
samples/misc/NodeServicesExamples/transpilation.js
Normal file
12
samples/misc/NodeServicesExamples/transpilation.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var fs = require('fs');
|
||||
var babelCore = require('babel-core');
|
||||
|
||||
module.exports = function(cb, physicalPath, requestPath) {
|
||||
var originalContents = fs.readFileSync(physicalPath);
|
||||
var result = babelCore.transform(originalContents, {
|
||||
presets: ['es2015'],
|
||||
sourceMaps: 'inline',
|
||||
sourceFileName: '/sourcemapped' + requestPath
|
||||
});
|
||||
cb(null, result.code);
|
||||
}
|
||||
Reference in New Issue
Block a user