fix: better message

pull/6991/head
bluwy 5 years ago
parent 58e86c67bf
commit 0b438c72b4

@ -152,16 +152,14 @@ export class SvelteComponentDev extends SvelteComponent {
$$slot_def: any;
constructor(options: IComponentOptions) {
// Ensure target is specified unless it is created inlined.
// Also ensure current_component is not null as it would be used as the component parent.
// It could be null if the Svelte instance isn't deduped, which target is then required.
if (
!options ||
(!options.target && (!options.$$inline || !current_component))
) {
if (!options || (!options.target && !options.$$inline)) {
throw new Error("'target' is a required option");
}
if (!options.target && !current_component) {
throw new Error("Multiple Svelte instances detected. Please ensure only one instance exists, or set the 'target' option");
}
super();
}

Loading…
Cancel
Save