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

Uncaught TypeError: ThemeWrapper is not a constructor #33

Closed
AnicetNgrt opened this issue May 21, 2021 · 8 comments
Closed

Uncaught TypeError: ThemeWrapper is not a constructor #33

AnicetNgrt opened this issue May 21, 2021 · 8 comments
Assignees
Labels
type/bug Something isn't working

Comments

@AnicetNgrt
Copy link

Hi.

Using sveltejs/template with nothing modified except svelte-themer ^0.4.8 installed as a dev dependency.

// App.svelte
<script>
	import { ThemeWrapper, ThemeToggle } from 'svelte-themer'
</script>
  
<ThemeWrapper>
	<main>
		<h1>svelte themer</h1>
		<ThemeToggle />
	</main>
</ThemeWrapper>

<style>
	:global(html) {
		background-color: var(--theme-colors-background, initial);
		color: var(--theme-colors-text, initial);
	}
</style>

npm run dev

In the browser console all I get is

Uncaught TypeError: ThemeWrapper is not a constructor
    create_fragment bundle.js:2449
    init index.mjs:1500
    App bundle.js:2518
    app main.js:3
    <anonymous> bundle.js:2536

I'm a Svelte noob, am I missing something?

Thank you for your consideration.

@josefaidt
Copy link
Owner

Hey 👋 thanks for raising this! I'm seeing this as well in a bare bones codesandbox instance. I think I messed the ES build up when aiming to support SSR in svelte-kit. After reverting that change it seemed to fix things (published to next)
https://codesandbox.io/s/hungry-haze-0lvm8?file=/App.svelte

Looking into producing the proper ssr bundle

@josefaidt josefaidt self-assigned this May 21, 2021
@josefaidt josefaidt added Priority: High type/bug Something isn't working labels May 21, 2021
@josefaidt
Copy link
Owner

@AnicetNgrt this should be fixed in 0.4.9!

@AnicetNgrt
Copy link
Author

Thank you! About to check this out

@AnicetNgrt
Copy link
Author

Upgraded to 0.4.9, looks like I still have it...

@josefaidt
Copy link
Owner

Hmm let me take a deeper look into what's going on.

@josefaidt
Copy link
Owner

@AnicetNgrt I'm not able to reproduce this with the template you mentioned using

npx degit sveltejs/template my-app

and adding svelte-themer as a devDependency or dependency should work with that setup

@AnicetNgrt
Copy link
Author

I'll try to restart from scratch tomorrow @josefaidt

@AnicetNgrt
Copy link
Author

@josefaidt It's working after restarting from scratch. Must have been a mistake on my side. Thanks for the fast fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants