Weird issues with using 'import' for anything other than string.

Skip to first unread message

Dec 24, 2015, 9:19:14 PM12/24/15
to StratifiedJS
Merry xmas eve.

Had a weird experience using a javascript library "sequelize.js". They have a method named import which is causing an error when being called from my conductance application. After some more investigation (in nodejs and conductance shell) it looks like using the word 'import' causes problems in some cases it shouldn't. Is this expected?

var import = 'test'  //Error
var test = 'import'  //OK
var test = {import: function(){console.log('running stuff')}}  //Error

Example Error:
Error: SJS syntax error in 'repl', line 1: Error: Invalid object literal syntax; property name expected, but saw 'import'
    at apollo-sys-nodejs.sjs:570
    at module file:///usr/local/lib/node_modules/conductance/node_modules/stratifiedjs/modules/nodejs/repl.sjs:116

  NodeJS version:      0.10.25
  NodeJS path:         /usr/bin/nodejs

  SJS version:         0.19.0
  SJS path:            /usr/local/lib/node_modules/conductance/node_modules/stratifiedjs/sjs

  Conductance version: 0.5.1
  Conductance path:    /usr/local/lib/node_modules/conductance/conductance

Alexander Fritze

Dec 24, 2015, 10:03:17 PM12/24/15
The first line legitimately fails because 'import' is a reserved word,
and isn't allowed as a variable name.
The use of reserved words as property names - i.e. your 3rd line (test
= { import: xxx }) - was legitimized by ECMAScript 5 and works in
plain JS in all recent browsers. Unfortunately we only added support
for this in SJS earlier this year and it hasn't made it into a
released version yet :/

Our current planning for a new release of SJS & Conductance puts us
somewhere into spring '16, so the only thing I can suggest if you need
this behavior is to use the versions of Conductance/SJS straight from
the github master branch (we Conductance from the github master branch
for a number of projects in production, so we consider them 'stable').

Provided you have nodejs installed on your system, and you have a
basic development tools setup, installing conductance from github
should be as easy as:

git clone
cd conductance

(Before running make, you might want to edit conductance/package.json
and throw away the devDependencies and optionalDependencies, so that
the build is faster)

> --
> You received this message because you are subscribed to the Google Groups
> "StratifiedJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
> For more options, visit

Dec 26, 2015, 5:42:06 PM12/26/15
to StratifiedJS,
Thanks for the explanation. I'll just use a workaround until the next version is officially released.
Reply all
Reply to author
0 new messages