Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rollupConfig and nitro config for externals does not work together #2332

Open
Llois41 opened this issue Apr 2, 2024 · 1 comment
Open

rollupConfig and nitro config for externals does not work together #2332

Llois41 opened this issue Apr 2, 2024 · 1 comment

Comments

@Llois41
Copy link

Llois41 commented Apr 2, 2024

Environment

  • Nitro 2.9.5
  • Node.js 18.19.1

Reproduction

Hopefully this is understandable by my description of the bug. If not, I can make a simple reproduction later on.

Describe the bug

Using

rollupConfig: {
      external: ['@unhead/vue'],
    },

instead of

externals: {
      external: ['@unhead/vue'],
    },

inside the nitro config (inside the nuxt.config.ts) does have different outputs. Using the rollupConfig only prevents the dependency from getting inlined but the nuxt/nitro build seems to ignore this. In the build output package.json and in the node_modules folder the dependency is missing.

Using the nitro configuration's external.externals field does not cause this behaviour. This is very un-intuitive (pun un-intended). Why would there be a very similiar field to the rollup one? And why is this not even documented?

I would expect that nuxt's/nitro's build (I'm not quite sure where to draw the line between those but I guess this is a nitro behavior) respects the given rollup config fully and not doing some strange things that causes bugs. The bug would be the missing dependency in the output so after trying to install the package that was build like that would fail.

Thanks for having a look into this.

Cheers, Luis

Additional context

No response

Logs

No response

@pi0
Copy link
Member

pi0 commented Apr 2, 2024

Hi. Please share a runnable (Nitro not Nuxt) reproduction app and also why you would need to use rollupConfig instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants