node项目构建用gulp出现的问题

import requireDir from 'require-dir';

requireDir('./tasks');

gulp.js写入上面代码,在cmd上运行时出现

E:\webstorm-demo\es6>gulp

E:\webstorm-demo\es6\gulpfile.js:1

(function (exports, require, module, __filename, __dirname) { import requireDir from 'require-dir';

                                                              ^^^^^^


SyntaxError: Unexpected token import

    at createScript (vm.js:80:10)

    at Object.runInThisContext (vm.js:139:10)

    at Module._compile (module.js:617:28)

    at Object.Module._extensions..js (module.js:664:10)

    at Module.load (module.js:566:32)

    at tryModuleLoad (module.js:506:12)

    at Function.Module._load (module.js:498:3)

    at Module.require (module.js:597:17)

    at require (internal/module.js:11:18)

    at Liftoff.handleArguments (C:\Users\Administrator\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)


cavin3613586
浏览 2210回答 1
1回答

pardon110

用webpack吧
打开App,查看更多内容
随时随地看视频慕课网APP