Class constructor SvelteComponent cannot be invoked without 'new'
See original GitHub issue🐛 Bug Report
Hi, got some strange error with a basic “Hello world” app.
Class constructor SvelteComponent cannot be invoked without 'new'
, pointing my app.js
🎛 Configuration (.svelterc, package.json, cli command)
Nothing special.
💻 Code Sample
Everything’s in the repo, but the code is quite simple :
import App from "./components/app.svelte";
const root = new App({
target: document.querySelector("#root"),
props: {},
});
export default root;
and the app.svelte is:
<script>
let name = 'world';
</script>
<h1>Hello {name.toUpperCase()}!</h1>
🌍 Your Environment
Svelte version ^3.1.0
, Parcel version ^1.12.3
, plugin version 3.0.0
Thanks in advance!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:43
- Comments:30 (8 by maintainers)
Top Results From Across the Web
Class constructor SvelteComponent cannot be invoked ...
When I build with webback, I will report an error:Class constructor SvelteComponent cannot be invoked without 'new'
Read more >How to resolve 'class constructor cannot be invoked without ...
This needs to be compatible with IE11 while using ES6 syntax. I get. Class constructor I cannot be invoked without 'new'. The pertinent...
Read more >Class constructor cn cannot be invoked without 'new'
Hi! We are using the plugin and is awesome! We noticed that when triyng to login with the address info@customercompany.co we get this...
Read more >yrv - npm Package Health Analysis | Snyk
When yrv adds a new route, it'll use any given key from its props — once routes are ... Class constructor SvelteComponent cannot...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Top GitHub Comments
This is not an issue specific to this plugin, this is an issue that is caused due to some design decisions made in Parcel. Specifically(as mentioned above) the decision not to transpile packages in the
node_modules
folder. You can see the issue in their repository here: https://github.com/parcel-bundler/parcel/issues/1655I’m subscribed to that issue, and to other issues regarding HMR, and will update this plugin when possible. Until then there is nothing we can do… EDIT: Updated the link to the issue, accidentally linked a different one.
I have the same issue.
Adding the following to
package.json
(as recommended by this comment) get things compiling and displaying on the page:However, HMR throws an error (browser console):
Manually refreshing the page works fine, so we can provide the
--no-hmr
CLI option to Parcel and get rid of that issue, but obviously this isn’t ideal as we no longer have HMR.