首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >babel5 --> babel6:模块属性

babel5 --> babel6:模块属性
EN

Stack Overflow用户
提问于 2016-01-23 17:39:50
回答 1查看 328关注 0票数 2

我试图弄清楚如何告诉babel6生成一个特定的模块语法(amd、commonjs等)。

这是我用来指定模块的方式:https://github.com/aurelia/metadata/blob/master/build/tasks/build.js#L48

代码语言:javascript
复制
gulp.task('build-commonjs', function () {
  return gulp.src(paths.output + jsName)
    .pipe(to5(assign({}, compilerOptions, {modules:'common'})))
    .pipe(gulp.dest(paths.output + 'commonjs'));
});

gulp.task('build-amd', function () {
  return gulp.src(paths.output + jsName)
    .pipe(to5(assign({}, compilerOptions, {modules:'amd'})))
    .pipe(gulp.dest(paths.output + 'amd'));
});

babel6给出了错误:Unknow option: base.modules

(多谢任何指引:)

错误:

代码语言:javascript
复制
events.js:141
      throw er; // Unhandled 'error' event
      ^
ReferenceError: [BABEL] C:\a\au\metadata\dist\aurelia-metadata.js: Unknown option: base.modules
    at Logger.error (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\logger.js:41:11)
    at OptionManager.mergeOptions (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\options\option-manager.js:262:18)
    at OptionManager.init (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\options\option-manager.js:416:10)
    at File.initOptions (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\index.js:191:75)
    at new File (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\file\index.js:122:22)
    at Pipeline.transform (C:\a\au\metadata\node_modules\gulp-babel\node_modules\babel-core\lib\transformation\pipeline.js:42:16)
    at DestroyableTransform._transform (C:\a\au\metadata\node_modules\gulp-babel\index.js:32:20)
    at DestroyableTransform.Transform._read (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:172:10)
    at DestroyableTransform.Transform._write (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:160:12)
    at doWrite (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:335:12)
    at writeOrBuffer (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:321:5)
    at DestroyableTransform.Writable.write (C:\a\au\metadata\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:248:11)
    at write (C:\a\au\metadata\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:623:24)
    at flow (C:\a\au\metadata\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (C:\a\au\metadata\node_modules\gulp\node_modules\vinyl-fs\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:664:5)
    at emitNone (events.js:67:13)
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-01-26 09:48:05

来自巴伯尔中的@thedark1337 1337

对于babel 6,您需要使用插件

另外,如果没有,您还需要babel-预设- ES2015,也可以从ES2015转到ES5

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34966644

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档