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

fix(create-app): the node in the svelte template is incorrectly mounted. #2947

Merged
merged 1 commit into from
Apr 12, 2021

Conversation

ruibaby
Copy link
Contributor

@ruibaby ruibaby commented Apr 11, 2021

Description

In the svelte template, it seems to need to be mounted on the app id node element. instead of the body node element.

Additional context


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.

Copy link
Member

@GrygrFlzr GrygrFlzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I erroneously based those files from the existing Vue templates.

@Shinigami92 Shinigami92 added the p3-minor-bug An edge case that only affects very specific usage (priority) label Apr 12, 2021
@patak-dev patak-dev merged commit 0825f7e into vitejs:main Apr 12, 2021
@ruibaby ruibaby deleted the fix/create-app-svelte-node branch April 12, 2021 16:51
@kresnasatya
Copy link

Hi everyone, I'm sorry to jump this PR that has been merged several years ago to start the discussion.

I would like to ask the reasons why do you use <div id="app"> as a target to mount the Svelte components? Why don't keep to use<body> instead? I change the target from <div id="app"> to <body>, the Svelte app still work.

The reason I change it because starting in Svelte version 3 (before choose Vite as scaffolding project), Svelte use <body> as the target to mount the svelte components. Currently I'm using Svelte + Vite and I feel weird if all the Svelte components must be glued or mounted to <div id="app"> as a target instead of <body>. It reminds me with React and Vue. In other hand, Svelte is free from this <div id="app"> rule.

I'm bit worried if someone who tried Svelte with Vite will be think that:

"I must use <div id="app"> to mount the Svelte components. Otherwise it doesn't work".

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.

5 participants