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

Component name "Block" throws error during compilation. #3854

Closed
milkbump opened this issue Nov 5, 2019 · 5 comments · Fixed by #3856
Closed

Component name "Block" throws error during compilation. #3854

milkbump opened this issue Nov 5, 2019 · 5 comments · Fixed by #3856
Labels

Comments

@milkbump
Copy link

milkbump commented Nov 5, 2019

Describe the bug
The component name "Block" seems to throwing the Svelte compiler off.

<script>
    import Block from "./Block.svelte"
	
</script>

<Block>my block</Block>

results in the error:

Identifier 'block' has already been declared (Note that you need plugins to import files that are not JavaScript)

But simply changing the component name import Blocky from "./Block.svelte" //path is the same works. Also, using the Block component more than once get's rid of the error.

https://svelte.dev/repl/10c035a984e24c3b85cabd7c1455c1af?version=3.12.1

Information about your Svelte project:

  • Chrome 78
  • MacOS
  • Svelte 3.12.1
  • Rollup used
@Conduitry Conduitry added the bug label Nov 5, 2019
@Conduitry
Copy link
Member

Weird. I thought this would have been fixed in the latest 3.13.0 alphas but this does not seem to be the case. Thanks for the report!

@Conduitry
Copy link
Member

This only affects dev mode. It looks like the block variable that's passed to dispatch_dev("SvelteRegisterBlock", ...) isn't properly deconflicted with existing variables.

@thinkrapido
Copy link

This is happening for me too after extracting block out to new a component.

@thinkrapido
Copy link

import Block form './Block.svelte'
doesn't work
refactoring to
import BuildingBlock from './Block.svelte'
does work

@thinkrapido
Copy link

thinkrapido commented Nov 5, 2019

Wow, @kwangure, you had the same problem at the same time as me. Incredible.

@thinkrapido
Copy link

Maybe it's a problem with slots

1 similar comment
@thinkrapido
Copy link

Maybe it's a problem with slots

Rich-Harris added a commit that referenced this issue Nov 6, 2019
deconflict `block` var used in dev mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants