路径[Symbol.iterator]不是函数(postcss插件)

时间:2016-10-21 17:08:55

标签: gulp ecmascript-6 babel postcss

我无法理解问题是什么以及如何解决它

https://github.com/LPGhatguy/postcss-sassy-import/blob/master/index.js#L72

Requiring external module babel-register

../node_modules/postcss-sassy-import/index.js:72
            opts.loadPaths = [...defaultLoadPaths, ...paths];
                                                      ^

TypeError: paths[Symbol.iterator] is not a function

我的gulp任务

var plugins = [
    sassyImport({loadPaths: origin => path.join(process.cwd(), "/app/styles")}),
    cssnext({browsers: ['last 2 version']}),
    postcssmedia(),
    ];
gulp.task('styles', () => (
gulp.src('app/styles/app.sss')
    .pipe(postcss(plugins, { parser: sugarss }))
    .pipe(rename({suffix: '.min'}))
    .pipe(gulp.dest('dist/assets/styles'))
));

1 个答案:

答案 0 :(得分:1)

{loadPaths: origin => path.join(process.cwd(), "/app/styles")}

应该是

{loadPaths: [origin => path.join(process.cwd(), "/app/styles")]}

loadPaths需要是一个数组。