-
Notifications
You must be signed in to change notification settings - Fork 54
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
SVG not defined error #82
Comments
@jeremyjamez im having the same issue.... did you find a solution ? |
What setup do you use? Which bundle? Do you use a bundler? Which one? |
@Fuzzyma i'm on nextJs 12.0.3, with webpack as the bundler |
In which part this error happens? Is the |
|
Webpack picks up the wrong bundle. As you can see in the package.json of this repo, the module key is set to ./src/svg.panzoom.js . If you import this package via esm, this key should be picked up and webpack should resolve it to this location. Instead it tries to load the bundled package for the browser. I guess you have to tell webpack to resolve this package to the correct path or you just |
its throws this error |
Well it clearly is a module. webpack does some magic there. You could go ahead and load those scripts in the browser and it would work |
I am getting the same error. Running it with angular v12 (thus webpack, I suppose). |
Since the code is only around ~400 lines, I might just derive/copy it as a standalone file to make it work on my end. Do let me know if and how I can attribute/credit you. PS: I have used your main library (svg.js) and its amazing. Thank you. |
You just have to put the license with it and then ist fine :) |
In my case, perhaps the problem is that I am using server side rendering(angular universal) and this library is running headless on node js. To get around this, some people have suggested the use of svgdom |
svgdom is usually how you run svg.js on the server because there is no other library that calculates geometry for you. But why on earth would you include panZoom on the server? :D Is there even a node version released? |
I was pre rendering a page on server that initializes with |
panZoon adds events to the dom. The server doesnt have a dom. You need to initialize it on the clint |
Got it. I am contemplating making an SPA now anyway. |
Hi there,
However, it seems that a common practice for NPM packages is to provide a UMD module in "main" file, which I think would solve that issue. |
I may have encounter this same issue
Soo here my solution. (typescript) The imports
The code
Work like a charm with webpack + typescript Hope it's will help you |
I imported svg.js and svg.panzoom.js as the docs say but svg.panzoom.js still gives the SVG not defined error.
The text was updated successfully, but these errors were encountered: