I want to get access to ES6 class from another file in my gulpfile.js
. It looks like that unable to use import
:
import MyClass from './development/myFramework/MyClass';
const instanceOfMyClass = new MyClass();
C:\MyIDE\projects\myProject\gulpfile.js:3 import MyClass from './development/myFramework/MyClass'; ^^^^^^ SyntaxError: Unexpected token import
Up to this point I always got the access to ES6-class from another folder by import
and don't know, how to do it by require
properly.
First: I know that some web-browsers don't understand ES6 modules, but what about Node.JS runtime?
And then, how I need to get access to MyClass
and the properly create the instance? Is require
the only way?