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

feat: new ssr.fileExtension option #8457

Closed
wants to merge 2 commits into from
Closed

feat: new ssr.fileExtension option #8457

wants to merge 2 commits into from

Conversation

antfu
Copy link
Member

@antfu antfu commented Jun 3, 2022

Allow meta frameworks to explicitly set the desired file extension. For example, in VitePress heavily relies on the file name conversion by adding .js to .md files for the chunk name. The current solution provides reasonable default, but may not be stable enough for meta-frameworks to consume (may vary on users' package.json).

Alternative

Or maybe, we could always generate as .js with a fake package.json to force the type resolution.

@patak-dev
Copy link
Member

We could already use entryFileNames to override the default. And you can keep the name but fix the extension with it, no? It is hidden in build.rollupOptions.output.entryFileNames but this is a more general issue. I would like if we provide a default build: { entryFileNames, chunkFileNames, assetsFileNames } as shortcuts to these, that would be generally useful

@bluwy
Copy link
Member

bluwy commented Jun 5, 2022

I'm also slightly leaning towards build.rollupOptions.output.entryFileNames to prevent config overlap. Maybe we could document instead of Vite's extension default for cases like this.

@antfu
Copy link
Member Author

antfu commented Jun 17, 2022

I am doing this because of vuejs/vitepress#707

In VitePress it assumes the output is .js (https://github.com/vuejs/vitepress/blob/52499221874e23ec437c416f4fc5ef3edb771857/src/node/build/render.ts#L52), where with the previous #8382, the output will not be stable when the users set type: module for their project root.

@antfu
Copy link
Member Author

antfu commented Jun 17, 2022

Alright, end up using https://github.com/vuejs/vitepress/blob/e0f30159b3141e48bfd3a4cc277880cdf486fabe/src/node/build/bundle.ts#L76-L80. Close for now to minimalize the config inteface.

@antfu antfu closed this Jun 17, 2022
@antfu antfu deleted the feat/ssr-file-ext branch March 8, 2023 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants