Jump to content
Search Community

Loading a bonus plugin locally

JLernDesign test
Moderator Tag

Recommended Posts

This feels like a simple issue but I am wracking my brain to get it working. Never had an issue before until I switched to GSAP 3. I have a local copy of the DrawSVGPlugin that I am loading with this code:

 

<script src="js/DrawSVGPlugin.min.js"></script>

And then when I go to view the page I am getting a bunch of errors in the console:

 

[Error] Not allowed to load local resource: file:///Users/JLern/WORK/dev/js/DrawSVGPlugin.min.js.map
[Error] Not allowed to request resource
[Error] Cannot load file:///Users/JLern/WORK/dev/js/DrawSVGPlugin.min.js.map due to access control checks.

Do I need a file called DrawSVGPlugin.min.js.map as well? Any thoughts? Thanks for your help!

Link to comment
Share on other sites

The updated ScrollMagic files did not solve the issue so I guess that wasn't it. Also tested without ScrollMagic entirely and same error. 

 

I went into the DrawSVGPlugin.js file and just deleted the last line that was looking for the map file (below) and now it's working.

//# sourceMappingURL=DrawSVGPlugin.min.js.map

 

Is there a danger in removing that line? Is there a way I can get access to the DrawSVGPlugin.min.js.map file? It wasn't listed with the others at the link above. Thanks!

  • Like 1
Link to comment
Share on other sites

Are you using a build tool? If so, which one? 

 

Does the error occur with absolutely nothing else in the project?

 

15 minutes ago, JLernDesign said:

Is there a danger in removing that line?

Other than not being able to use source maps, no, there shouldn't be an issue.

 

16 minutes ago, JLernDesign said:

Is there a way I can get access to the DrawSVGPlugin.min.js.map file? It wasn't listed with the others at the link above.

Oops, sorry. I forgot that the club plugin files aren't hosted publicly on GitHub. @GreenSock I don't see the map files in the club ZIP download - am I missing something?

Link to comment
Share on other sites

2 hours ago, ZachSaucier said:

Are you using a build tool? If so, which one? 

 

No build tool, just loading the script at the bottom of my HTML. I am able to load the gsap core without any problems. Same error happens if I try to load any of the gsap plugins.

 

2 hours ago, ZachSaucier said:

Does the error occur with absolutely nothing else in the project?

 

 

Just loading these scripts:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.0.5/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.0.5/MotionPathPlugin.min.js"></script>
<script src="js/DrawSVGPlugin.min.js"></script>

 

Also tried including that map file and still throwing the error. Only thing working right now is to remove the line of code at the bottom.

Link to comment
Share on other sites

Yeah, that "//# sourceMappingURL=DrawSVGPlugin.min.js.map" line is purely for browsers with Dev Tools open, and it tells them were to get debugging information about the raw (unminified) source code. Totally optional and you're welcome to ignore that. It's not really an "error" at all - think of it like metadata for developers. 

 

I can put the .map files into the /minified/ folder in the bonus zip in the next release if that'd help. I originally thought they might just confuse people, but perhaps it's helpful for cases like this. 

  • Like 2
Link to comment
Share on other sites

11 hours ago, GreenSock said:

I can put the .map files into the /minified/ folder in the bonus zip in the next release if that'd help. I originally thought they might just confuse people, but perhaps it's helpful for cases like this. 

I might put it in a sub-directory of the minified folder and change the path to accommodate. I think it'd be less confusing.

Link to comment
Share on other sites

1 hour ago, ZachSaucier said:

I might put it in a sub-directory of the minified folder and change the path to accommodate. I think it'd be less confusing.

I actually think that might compound the problem because:

  • The minified files would technically be different than all the other files with those same names, like the ones that reside on the CDN. The path to the map file would be different...so it'd be weird to have two files with identical names and are the same version of GSAP...but contain different contents. 
  • My understanding is that it's a widely-accepted convention to keep the .map files with the files they describe (same directory)
  • It'd add yet another folder to the zip, making it potentially confusing/intimidating for users to understand which things they need and which folder(s) to use. 

I'm inclined to just stick with the convention we're using everywhere else (including on the CDN) and have the map files reside with the minified files.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...