Tools: lodash: module is not defined

Created on 18 Jan 2018  Â·  3Comments  Â·  Source: Polymer/tools

Hey!

I'm using web-component-tester just with a JS file. When testing I always get errors during test initialization.

image

Seems like something wrong with transpilation / index.js selection? Funnily enough, my actual tests still run. Its just that the end result never terminates with OK because that one thing fails.

web-component-tester Medium Available Bug

Most helpful comment

i terminated the error by changing the lodash/index.js into lodash/lodash.js in file node_modules/wct-browser-legacy/browser.js around line 217

All 3 comments

I've taken a deeper dive on this as I'm running into this with modulizer.

It seems as if this fails for anything relying on a newer version of lodash (above version 3) e.g. polymer-analyzer via @polymer/gen-typescript-declarations.

In WCT we seem to load simply lodash/index.js and the relative path is determined by the relative path of browser.js. If there are multiple versions of lodash the dir structure may end up as

my-element
 ├ test/
 | â”” index.js (points to browser js via ../../)
 â”” node_modules/
   ├ lodash(v4)/
   â”” web-component-tester/
     ├ browser.js
     â”” node_modules/
         â”” lodash(v3)/

This will make the browser load lodash v4 at the same directory level as wct.

pinging @usergenic for WCT
pinging @aomarks for gen TS

i terminated the error by changing the lodash/index.js into lodash/lodash.js in file node_modules/wct-browser-legacy/browser.js around line 217

Hi @aomarks,

This issue is still happening for me using:

"wct-browser-legacy": "^1.0.2"

whenever another package depends on lodash >= 4. Should it not be "Closed" or is there another branch I should be using instead?

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ronnyroeller picture ronnyroeller  Â·  4Comments

pmaudsley picture pmaudsley  Â·  3Comments

web-padawan picture web-padawan  Â·  4Comments

emilbillberg picture emilbillberg  Â·  3Comments

rasto68 picture rasto68  Â·  4Comments