Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import can't be used in chrome 61?

I'm trying to play ES6 features in the latest release version of chrome, that is chrome 61, and I met the error during using the import key word. Technically, import is used as following method but the console showed me errors:

import Mymodule from "Mymodule.js"

the console printed:

Uncaught SyntaxError: Unexpected identifier

I have already turn the following experimental features on:

chrome://flags/#enable-javascript-harmony
chrome://flags/#enable-module-scripts

and following off:

chrome://flags/#disable-javascript-harmony-shipping
like image 621
Arvin Avatar asked Sep 29 '17 08:09

Arvin


1 Answers

The problem is that from "Mymodule.js".

A module must be either a full URL (including a protocol), an absolute path (starting with /), or a relative path (starting with ./ or ../).

Any other strings are reserved for future use.

source: https://jakearchibald.com/2017/es-modules-in-browsers/#bare-import-specifiers-arent-currently-supported (referenced from https://developers.google.com/web/updates/2017/09/nic61#modules )

like image 133
himdel Avatar answered Nov 03 '22 11:11

himdel