Search code examples
gulpecmascript-6babeljspostcss

paths[Symbol.iterator] is not a function(postcss plugin)


I can not understand what the problem is and how to solve it

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

my gulp task

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'))
));

Solution

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

    should be

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

    loadPaths needs to be an Array.