SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' - Gulp

后端 未结 10 797
天命终不由人
天命终不由人 2020-11-27 20:10

Consider the following two files:

app.js

import Game       from \'./game/game\';
import React      from \'react\';
import ReactDOM   fro         


        
10条回答
  •  离开以前
    2020-11-27 20:38

    This error can be caused by not including tsify plugin to compile typescript in the gulp task.

    example

        var tsify = require('tsify');
    
        return browserify({ ... })
          .plugin(tsify)
          .transform(babelify.configure({
            presets: ["es2015"]
          }))
          ...
    

    See installation and usage here: https://www.npmjs.com/package/tsify

提交回复
热议问题