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

export * as is flattened in SSR #3934

Closed
6 tasks done
hgl opened this issue Jun 24, 2021 · 1 comment
Closed
6 tasks done

export * as is flattened in SSR #3934

hgl opened this issue Jun 24, 2021 · 1 comment

Comments

@hgl
Copy link
Contributor

hgl commented Jun 24, 2021

Describe the bug

When loading SSR, given these two files:

entry-server.js

export * as maths from "./maths"

maths.js

export function square (x) {
	return x * x;
}
// other exports

vite.ssrLoadModule('/src/entry-server.js') returns a module that directly contains the square function, instead of a maths object.

Note that it's correctly handled by rollup.

Reproduction

https://github.com/hgl/vite-repo-export-as

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  Binaries:
    Node: 14.17.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.13 - /usr/local/bin/npm
  npmPackages:
    vite: ^2.3.8 => 2.3.8 

Used package manager: yarn


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

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
@github-actions
Copy link

This issue gets locked because it has been closed for more than 14 days.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 13, 2021
aleclarson added a commit to aleclarson/vite that referenced this issue Nov 8, 2021
Co-authored-by: Alec Larson <1925840+aleclarson@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants