beyonk-group / gdpr-cookie-consent-banner

A GDPR compliant cookie consent banner implementation
MIT License
248 stars 42 forks source link

svelte:options customElement #56

Open BigBuckBunny opened 11 months ago

BigBuckBunny commented 11 months ago

Hi,

A compile error is generated with version 11:

[vite-plugin-svelte] /node_modules/@beyonk/gdpr-cookie-consent-banner/src/lib/Ba nner.svelte:1:16 The 'customElement' option is used when generating a custom element. Did you forget the 'customElement: true' compile option ? 1:

To resolve this, I had to include in my svelte.config.js the following:

compilerOptions: { customElement: true, },

It does not seem right that I have to mod my config to compile.

Thanks,

Pierre

antony commented 11 months ago

is it an error or a warning?

a bit annoying, but if we want to publish the banner as a WebComponent too, we need to include that. I'm not sure there is a way around it.

BigBuckBunny commented 11 months ago

Hi,

Sorry it was a warning.

Might I suggest appending to your Svelte example the modification to svelte.config.js in the Readme.md.

Thanks for the update,

Pierre

antony commented 10 months ago

It says in the warning what you need to do, so not sure this is necessary.

I feel like this is an issue within the way Svelte works, since you don't actually want custom element output in a regular svelte project.

the compiler should know that you're seeing the options tag in a project dependency, not the main project, and not warn.

i'll raise an issue with Svelte (or you can)

stalkerg commented 10 months ago

@antony did you make an issue?

antony commented 10 months ago

Hey Yury, no, I've not had time.

Feel free to do it if need be.

On Sun, 5 Nov 2023 at 06:48, Yury Zhuravlev @.***> wrote:

@antony https://github.com/antony did you make an issue?

— Reply to this email directly, view it on GitHub https://github.com/beyonk-group/gdpr-cookie-consent-banner/issues/56#issuecomment-1793654269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVORLXTNPGMIUNKZFF6W3YC4ZCVAVCNFSM6AAAAAA5Z5WYTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJTGY2TIMRWHE . You are receiving this because you were mentioned.Message ID: @.***>

Cayllen commented 9 months ago

Not sure if this is related but I cannot use the cookie banner because of the following issue: image

Cayllen commented 9 months ago

Actually solved, seems I used an old version of sveltekit

belte42 commented 6 months ago

Still shows an error on latest sveltekit "@sveltejs/kit": "^2.5.0". The problem with this is once I add

compilerOptions: {
customElement: true,
},

pre-rendering with static adapter kit breaks and CSS is no longer loaded from Svelte pages and components.

antony commented 6 months ago

@belte42 because you're trying to mark your entire project as a custom element, which won't work. The "did you forget to add" customElement: true warning is just a warning, and can be safely ignored.

If it bothers you a lot, please raise a SvelteKit issue and I'll discuss it with the others and see if I can implement a fix - but at the moment, I don't have time to do it.