runtimeZero
runtimeZero

Reputation: 28116

PhantomJs: Can't find variable map

I receive the following error:

INFO [karma]: Karma v0.13.9 server started at http://localhost:9018/

INFO [launcher]: Starting browser PhantomJS

PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
      ReferenceError: Can't find variable: Map
      at /Users/runtimeZero/code/vendor/inert/inert.min.js:589

I understand that I am including a file called inert.js which is using ES6 Map() . This is freaking out PhantomJs.

So I included core-js/es6/map.js polyfill in my karma config under files. However that does not resolve the issue.

Any tips ?

Upvotes: 19

Views: 9572

Answers (2)

jamesjara
jamesjara

Reputation: 554

I think PhatomJS is not supporting ES6 Map, so you need to try with a polyfill, I'm using babel polyfill npm install babel-polyfill --save-dev

files: [
    { pattern: 'node_modules/babel-polyfill/browser.js', instrument: false}, 
],

Upvotes: 17

Sul Aga
Sul Aga

Reputation: 6792

you need to install es6-shim and add it to your files section in karma config file.

npm install es6-shim --save

in your karma.config.js add it to your list of files

files: [
    'node_modules/es6-shim/es6-shim.js'
]

Upvotes: 8

Related Questions