Closed trandaison closed 5 months ago
My workaround is set failOnWarn: false
by create a build.config.ts
import { defineBuildConfig } from "unbuild";
export default defineBuildConfig({
failOnWarn: false,
});
However, I think this is a bug, should be fixed in the module builder itself, and the docs should show an example how to custom the build config as well.
The reason this is happening is that your module is importing types from the runtime code, which itself is augmenting #app
.
Instead, you should likely extract your types into a location where they can be shared between your runtime and build-time code.
If you do add config, it should likely be to add #app
to your externals, like this:
import { defineBuildConfig } from "unbuild"
export default defineBuildConfig({
externals: ['#imports', '#app'],
})
We may be able to improve this experience as having shared types between build/runtime is often necessary.
I created a module https://github.com/trandaison/nuxt-3-auth, the playground is working perfectly. However, when I run
npm run prepack
, I got this errorSince
AuthStorage.ts
is not using any import from#app
anymore, I don't know why it still throws this error.=====
Darwin
v18.16.0
3.8.2
3.9.1
2.8.1
pnpm@8.15.0
-
-
-
-