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

Custom Element build target is missing #40

Closed
nileshtrivedi opened this issue Nov 11, 2021 · 2 comments
Closed

Custom Element build target is missing #40

nileshtrivedi opened this issue Nov 11, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@nileshtrivedi
Copy link

nileshtrivedi commented Nov 11, 2021

If the Svelte component includes <svelte:options tag="my-element" />, then the following warning is shown with npm run build:

(!) Plugin svelte: The 'tag' option is used when generating a custom element. Did you forget the 'customElement: true' compile option?
src/Component.svelte
1: <svelte:options tag="my-element" />

Changing the svelte plugin call in rollup.config.js (following the example in their own README) to this:

svelte({
	compilerOptions: {customElement: true}
}),

throws this error message:

% npm run build

> build
> rollup -c


src/index.js → dist/index.mjs, dist/index.js...
[!] (plugin svelte) Error: Unrecognized option 'compilerOptions'
src/Component.svelte
Error: Unrecognized option 'compilerOptions'
    at /Users/nileshtr/my-new-component/node_modules/svelte/compiler.js:31305:20

It's not clear what change is needed in rollup.config.js to get a custom element build by setting customElement: true compile option. Ideally, this template should be ready to export the components as custom elements. But at minimum, the README should document what change to make in the config to get a custom element build.

@antony
Copy link
Member

antony commented Nov 11, 2021

Looks like the readme references rollup-plugin-svelte@7 but package.json references rollup-plugin-svelte@6

@antony antony added the bug Something isn't working label Nov 11, 2021
@antony
Copy link
Member

antony commented Nov 11, 2021

Fixed by #36

@antony antony closed this as completed Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants