-
-
Notifications
You must be signed in to change notification settings - Fork 1k
fix(vite): fix distDir resolution #6215
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,5 @@ | ||||
import { fileURLToPath } from 'node:url' | ||||
import { resolve } from 'pathe' | ||||
|
||||
export const distDir = resolve(fileURLToPath(import.meta.url), '../..') | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file was intentionally in top-level to match source and generated chunk path. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but unbuild always extracts it into a chunk even when I have directly imported it in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was a non-problem because we used to have only one file for this package. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. The only issue is that is approach can be easily broken if chunk generation changes with unbuild>rollup. Currently, we use this workaround for the main nuxt pkg: framework/packages/nuxt/src/dirs.ts Line 5 in 5a042cd
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, updated |
||||
export const pkgDir = resolve(distDir, '..') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is going to be the default option, I think we can safely import it normally when removed experimental flag. Difference is small but rollup this way can optimize startup time to add nested dependencies to top level
dist/index.mjs