Skip to content

fix(ssr): dont replace rollup input#7275

Merged
patak-dev merged 1 commit intovitejs:mainfrom
BuilderIO:fix-ssr-options
Jun 13, 2022
Merged

fix(ssr): dont replace rollup input#7275
patak-dev merged 1 commit intovitejs:mainfrom
BuilderIO:fix-ssr-options

Conversation

@manucorporat
Copy link
Contributor

Description

Setting custom input in rollupConfig always replaces, even the ssr entry points.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@jeffydc
Copy link
Contributor

jeffydc commented Mar 11, 2022

Can you describe more about why this change is required?

@manucorporat
Copy link
Contributor Author

Basically, the --ssr my.ssr.entry.tsx is not used at all if a rollupConfig input is specified.

export default defineConfig(({ mode }) => {
  return {
    build: {
      rollupOptions: {
        input: ['src/main.tsx', 'index.html'],

Notice that we already generate the final input, using rollupConfig when necessarily...
https://github.com/vitejs/vite/pull/7275/files#diff-aa53520bfd53e6c24220c44494457cc66370fd2bee513c15f9be7eb537a363e7R381-R385

But this value is override and never used because this line:
https://github.com/vitejs/vite/pull/7275/files#diff-aa53520bfd53e6c24220c44494457cc66370fd2bee513c15f9be7eb537a363e7R432

replaces it.

@jeffydc
Copy link
Contributor

jeffydc commented Mar 11, 2022

I see. For your example, which input do you expect to pass to the rollup since it now has ssr entry and rollupOptions.input?

@manucorporat
Copy link
Contributor Author

I would expect to use the one I passed in --ssr

@manucorporat
Copy link
Contributor Author

Any updates?

@patak-dev
Copy link
Member

Sorry @manucorporat, I missed this one til now

@patak-dev patak-dev merged commit 9a88afa into vitejs:main Jun 13, 2022
@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jun 13, 2022
@SteveDesmond-ca
Copy link

Per #9086, it seems this may have gone a little too broad. Any thoughts on how to rein it back in a bit? Or is my use case now officially unsupported?

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

Labels

p3-minor-bug An edge case that only affects very specific usage (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments