Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

vis network with Polymer 3 on Chrome TypeError: Cannot set property 'vis' of undefined at webpackUniversalModuleDefinition #4282

Open
scenaristeur opened this issue Apr 14, 2019 · 0 comments

Comments

@scenaristeur
Copy link

scenaristeur commented Apr 14, 2019

Starting point : Polymer3 starter-kit as described here : https://pwa-starter-kit.polymer-project.org/setup

with

git clone --depth 1 https://github.com/Polymer/pwa-starter-kit my-app
cd my-app

then i installed vis with "npm install --save vis"

I run it with 'npm run start'

My network is shown in Firefox 66, but in Chrome 73, I got this error

vis.js:26 Uncaught (in promise) TypeError: Cannot set property 'vis' of undefined
    at webpackUniversalModuleDefinition (vis.js:26)
    at vis.js:26

it looks that the root is undefind with Polymer and the modules so I added this two lines

	else if (typeof exports == 'undefined' && typeof module == 'undefined'&& typeof define == 'undefined')
      window['vis'] =  factory();

in webpackUniversalModuleDefinition of vis.js, like that


	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else if(typeof exports === 'object')
		exports["vis"] = factory();
	else if (typeof exports == 'undefined' && typeof module == 'undefined'&& typeof define == 'undefined')
      window['vis'] =  factory();
  else
		root["vis"] = factory();

here is the result after modification https://spoggyfr.netlify.com/
and the source is here https://github.com/scenaristeur/spoggyfr

and the network appear in Chrome. Do you think it is a problem with vis ? Polymer ? Webpack ?
Thanks

@scenaristeur scenaristeur changed the title vis network with Polymer 3 on Chrome vis network with Polymer 3 on Chrome TypeError: Cannot set property 'vis' of undefined at webpackUniversalModuleDefinition Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant