1

In latest versions of Firefox and Chrome, I try make export variable.

index.js:

'use strict'
import { bla } from './helper';
console.log(bla);

helper.js:

export var bla = 20;

but Chrome console display follow error message:

Uncaught SyntaxError: Unexpected reserved word

firefox console display follow error message: SyntaxError: modules are not implemented yet

import { bla } from './helper'; <--

also I try follow variant index.js:

'use strict'
import { bla } from './helper.js';
console.log(bla);

also I try follow variant index.js:

'use strict'
import { bla } from 'helper.js';
console.log(bla);

but the error message remains the same.

stackow101
  • 121
  • 6

1 Answers1

1

This is not supported in Firefox and Chrome. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Browser_compatibility.

You'll need some kind of preprocessor or transpiler to make this work.