Emanuel
CommonJS not transpiled to esm
I wrote a custom Nuxt 3 Module which imports and initializes a plugin which again uses a package writte in CJS. My problem is that when I use the module I get errors related to CJS not being able to be interpreted. When I add my module to the "build.transpile" option in nuxt.config.ts is still does not work. Any ídeas? I also tried to add the npm package which causes the error directly but also this does not work.
1 replies
Nuxt 3 Modules provide Types to Nuxt Applications
What is the recommended way to provide types from a nuxt 3 module to a Nuxt App so that the App can import it using something like import type someType from "@company/myModule"?
Ways I found:
1. export all types inside the module.ts
2. wrap the type exports into a export/declare module "@company/myModule"
4 replies