-
Notifications
You must be signed in to change notification settings - Fork 18
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
Script detection doesn't work in current versions of SvelteKit #24
Comments
@Rich-Harris I did manage to fix that part of the problem in my local repo, however now I get this error when the extension is executed:
from generated (and externalised script) __sveltekit_1yt2rwz = {
env: {},
base: new URL(".", location).pathname.slice(0, -1),
element: document.currentScript.parentElement
};
const data = [null,null];
Promise.all([
import("./app/immutable/entry/start.e005700e.js"),
import("./app/immutable/entry/app.ae8f820f.js")
]).then(([kit, app]) => {
kit.start(app, __sveltekit_1yt2rwz.element, {
node_ids: [0, 2],
data,
form: null,
error: null
});
}); I do get Do you have any useful pointers to fix that? Reading that JavaScript I think we need to do more than externalized module generation from inline script. |
Digging further into this, I believe fix needs to come from SvelteKit side. As mentioned by @Rich-Harris sveltejs/kit#3555 needs to be implemented because modules have no There is an ongoing discussion at WHATWG started years ago. 🤦🏻♂️ Side note: create-react-app had the same problem apparently and then they fixed it. EditIf anyone like me excited about both Svelte and extension development, until this gets fixed we may try Astro and plain Svelte route. Did not fully tested myself yet , will update here. UpdateAstro generates inline script in the output as well. |
Apparently have not got notifications for this repo turned on! Will need to investigate the ins and outs of this issue to fully understand it. |
bump! |
If you need a workaround and don't want to downgrade Sveltekit to 1.7.2, the I just copied the script to my project and appended it to the npm build command as suggested in the tutorial. Seems to do the trick for me, whereas before I was getting CSP errors about inline scripts. Edit: I had to add |
It still would be nice to have an solid build in solution from sveltekits side. Really disappointing to see that issue going on for over 3 years and not much happening in regard to that. And it only is one single inline placement. In regard to that normal Svelte doesn't seem to have that problem. (Maybe cuz it does not utilize the routing feature.) |
See sveltejs/kit#9277 — since sveltejs/kit#8901, this logic...
sveltekit-adapter-browser-extension/adapter-browser-extension.mjs
Lines 63 to 73 in dc45063
...no longer works, because the
<script>
no longer hastype="module"
(as this would defeat streaming). The 'proper' solution might well be to finally implement sveltejs/kit#3555The text was updated successfully, but these errors were encountered: