Open chirudeepnamini opened 1 year ago
Realized that we don't need to add Content security policy in IIS web.config, when we add csp in sveltekit.
Browsers don't allow "unsafe-inline"
for browser extensions. But adapter-static
even uses inline scripts when you disable prerendering. I'm a bit clueless on how to use SvelteKit for web extensions because of this.
Describe the bug
I am using Static adapter with sveltekit. My adapter configuration is as follows:
**import adapter from '@sveltejs/adapter-static';
export default { kit: { adapter: adapter({ // default options are shown. On some platforms // these options are set automatically — see below pages: 'build', assets: 'build', fallback: undefined, precompress: false, strict: true }), csp:{ mode:"hash", directives: { 'script-src': ['self'] },
}; This will render the pages after building . for example i took a simple code of counter increment and decrement in svelte. The code: in +page.svelte of routes directory.
count is {count}
<button on:click={()=>count++}>increment <button on:click={()=>count--}>decrement**
After running npm run build, it produced the index.html of in build for this route. The code of the html:
**<!DOCTYPE html>
count is 0