0

After running my grunt build task i'm getting the following error:

>> Error: Parsing file /Users/xx/testProject/node_modules/vfc/js/file.js: 'import' and 'export' may appear only with 'sourceType: module' (12:0)

I'm using Grunt and Browserify to build a javascript project.

In testProject I require vfc via npm (node_module).

var vfc = require('vfc');

vfc is written in es6 style, using export, class etc.

My gruntfile looks like this:

var gruntConfig = {

  browserify: {
    dist: {
      options: {
        transform: [
          ["babelify"]
        ]
      },
      files: {
        'bin/build.js': ['./src/main.js']
      }
    }
  }
};

module.exports = function(grunt) {
    grunt.initConfig(gruntConfig);
    grunt.loadNpmTasks('grunt-browserify');

    grunt.registerTask('build', ['browserify']);
};
Yoni Dabush
  • 220
  • 4
  • 13

0 Answers0