使用babel与@babel/node

安装

yarn add -D @babel/cli @babel/node

编译entry-server.js

yarn babel ./src/ssr/entry-server.js  --presets=@babel/preset-env
var hello = () => {
return "Hello World";
}; console.log(hello());

结果

"use strict";

require("core-js/modules/es6.array.iterator");

require("core-js/modules/es6.promise");

require("core-js/modules/es7.promise.finally");

var hello = function hello() {
return "Hello World";
}; console.log(hello()); Done in 2.28s.

编译并运行entry-server.js

yarn babel-node ./src/ssr/entry-server.js  --presets=@babel/preset-env
var hello = () => {
return "Hello World";
}; console.log(hello());

结果

Hello World
Done in 2.90s.
上一篇:11、Semantic-UI之分割线


下一篇:c# 遍历所有安装程序 获取所有已经安装的程序