为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

cavin3613586 2018-11-25 19:19:01
import requireDir from 'require-dir'; requireDir('./tasks');gulp.js写入上面代码,在cmd上运行时出现E:\webstorm-demo\es6>gulpE:\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)
查看完整描述

1 回答

?
pardon110

TA贡献1038条经验 获得超227个赞

用webpack吧

查看完整回答
反对 回复 2018-11-25
  • cavin3613586
    cavin3613586
    我用webpack时,出现这个问题
  • cavin3613586
    cavin3613586
    throw new WebpackOptionsValidationError(webpackOptionsValidationErrors); ^ WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
  • cavin3613586
    cavin3613586
    throw new WebpackOptionsValidationError(webpackOptionsValidationErrors); WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
点击展开后面1
  • 1 回答
  • 0 关注
  • 2215 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信