javascript - webpack 打包http服务器代码转es6,无法运行啦
大家讲道理
大家讲道理 2017-04-17 16:32:22
0
1
591

编写2.js代码:

写一段这样的代码,我们使用webpack把es6语法转成es5语法,

webpack.config.js代码:


运行webpack

显示没有问题;

然后运行编译后的文件,出现如下问题,为什么呀?改如何解决????急。。。。。。。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
洪涛

I have a question, why do you need to use webpack to compile on the server side?
Have you ever thought about making your server support babel?

Install babel-cli Just let Node support babeljs. Moreover, the latest version of Node still supports many ES6 features by default

npm -g  install babel-cli

Execute

babel-node es6.js
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template