Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.scriptTag is undefined #22

Open
sirrah23 opened this issue Aug 11, 2018 · 1 comment
Open

this.scriptTag is undefined #22

sirrah23 opened this issue Aug 11, 2018 · 1 comment

Comments

@sirrah23
Copy link

I get the error message this.scriptTag is undefined and a blank Mappa canvas when I build my code to get it ready for deployment for a project that I am working on. My code is instantiating a Mappa object via the Leaflet provider and the error message appears when I call the overlay method on said object using an existing canvas as the argument.

After some tracing and print-debugging I found the following in Mappa/src/providers/tile/Leaflet.js:

if (this.constructor.name === 'Leaflet') {
    this.loadSrc();
}

The project that I am working on is using the Vue.js framework and it uses the vue-cli's build command to minify/uglify the code. As a part of this process classes get renamed to single character variants and so this.constructor.name no longer equals Leaflet (in my case it became the single character t) which causes this.loadSrc() to not run. Because of this the scriptTag property is not getting defined thus leading to the the error that I see.

I took a look at the code for the other tile-based providers and I can't see a reason for this check to be here, I don't think we need. Once the check is removed the issue that I've observed will get resolved as well.

@54M5M17H
Copy link

I’ve been experiencing the same issue when building with webpack, as part of a Vanilla JS application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants