Hi, all. When I try to import the DrawSVGPlugin to a NuxtJS project, I get the following error:
TypeError: Cannot read property 'defaultView' of undefined
at /Users/mdf/Sites/nuxtproject/node_modules/gsap/DrawSVGPlugin.js:19:27
at Object.<anonymous> (/Users/mdf/Sites/nuxtproject/node_modules/gsap/DrawSVGPlugin.js:202:54)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (m
Chalk this up to needing to take a step back. You're right, I did not need to be using during the headless render. I should have been adding it when the server-side code is hydrated with the client-side code.
If anyone comes across a similar problem, I was able to load the plugin successfully by adding the following to my nuxt.config file:
build: {
extend (config, ctx) {
if (ctx.isClient) {
config.entry.app = ['gsap','~plugins/DrawSVGPlugin', config.entry.app]