I am trying to add a paintworklet to my application, but I am having a really hard time.
The worklet is a npm dependency, but worklets can't be inlined, they need to be registered like so:
CSS.paintWorklet.addModule('url/to/module.js');
I am having a hard time, because even though that currently works in my application, I am not sure if this is the right way to go about it, or if it will work in production. Currently, my url points to a file inside node_modules
and I am not sure if nuxt will do anything with this.
I am currently doing this with a .client.js
file inside the plugins folder. But they need an export default function()
, but the worklet code does not have an export.
What I am currently trying to do, is tell nuxt somehow to grab certain files from node_modules
and serve them as assets somehow, and then reference them some other way. But I cannot find any resources on this.
Any ideas would be appreciated.