Closed noah-seltzer closed 1 year ago
Please look into how esm modules are loaded in the browser. node knows what npm is and that it can find its modules on node_modules. The browser doesn't. You have to give it the correct path to the javascript files
In case you know that and you use a bundler already, I don't really have an idea why it is not working. Can you share a reproduction in this case?
You should try the following in your Vue component:
const SVG = require('@svgdotjs/svg.js');
Worked for me
its been too long since the original comment for me to remember what I did, but I just checked my repo and import { SVG } from '@svgdotjs/svg.js'
is working just fine. Must have been a webpack issue
thanks everyone who commented :)
I've been happily using SVGJS 3.0.0 with svgdom in nodejs with no issues for years. Today I tried to move some of my SVGJS code into the browser, but I can't seem to import it with the standard
import { SVG } from '@svgdotjs/svg.js'
Is there anything I'm doing wrong here?
My front end stack is nuxt 3 + vue 2