-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Description
Describe the bug
In a basic Kit set up, when using Vite define
static replacement globals, if a <style>
tag is present in the file where the global is used, a 500 is returned and the app breaks on npm run dev
.
Reproduction
Reproduction here:
https://github.com/arxpoetica/sveltekit-6qwj7g
https://stackblitz.com/edit/sveltekit-6qwj7g?file=src%2Froutes%2Findex.svelte
To reproduce:
git clone https://github.com/arxpoetica/sveltekit-6qwj7g.git
cd sveltekit-6qwj7g
npm install
npm run dev
Logs
7:09:31 PM [vite-plugin-svelte] /Users/robert/Documents/@workspace/svelte-project/bugs/sveltekit-6qwj7g/src/routes/index.svelte:1:18 '__TESTING__' is not defined. Consider adding a <script> block with 'export let __TESTING__' to declare a prop
7:09:31 PM [vite-plugin-svelte] /Users/robert/Documents/@workspace/svelte-project/bugs/sveltekit-6qwj7g/src/routes/index.svelte:2:6 '__TESTING__' is not defined. Consider adding a <script> block with 'export let __TESTING__' to declare a prop
Parse failure: Unexpected token (6:120)
Contents of line 6: map: "{\"version\":3,\"file\":\"index.svelte\",\"sources\":[\"index.svelte\"],\"sourcesContent\":[\"<div>{console.log("testing")}</div>\\n<div>{"testing"}</div>\\n\\n<style>\\n\\tdiv {\\n\\t\\tcolor: red;\\n\\t}\\n *{}</style>\\n\"],\"names\":[],\"mappings\":\"AAIC,GAAG,eAAC,CAAC,AACJ,KAAK,CAAE,GAAG,AACX,CAAC,AACD,eAAC,EAAE\"}"
Error: Parse failure: Unexpected token (6:120)
Contents of line 6: map: "{\"version\":3,\"file\":\"index.svelte\",\"sources\":[\"index.svelte\"],\"sourcesContent\":[\"<div>{console.log("testing")}</div>\\n<div>{"testing"}</div>\\n\\n<style>\\n\\tdiv {\\n\\t\\tcolor: red;\\n\\t}\\n *{}</style>\\n\"],\"names\":[],\"mappings\":\"AAIC,GAAG,eAAC,CAAC,AACJ,KAAK,CAAE,GAAG,AACX,CAAC,AACD,eAAC,EAAE\"}"
at ssrTransform (/Users/robert/Documents/@workspace/svelte-project/bugs/sveltekit-6qwj7g/node_modules/vite/dist/node/chunks/dep-55830a1a.js:55904:15)
at doTransform (/Users/robert/Documents/@workspace/svelte-project/bugs/sveltekit-6qwj7g/node_modules/vite/dist/node/chunks/dep-55830a1a.js:56746:48)
System Info
System:
OS: macOS 11.2.3
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 1.08 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.3.0 - ~/.volta/tools/image/node/16.3.0/bin/node
Yarn: 1.22.5 - ~/.yarn/bin/yarn
npm: 7.15.1 - ~/.volta/tools/image/node/16.3.0/bin/npm
Browsers:
Chrome: 94.0.4606.71
Edge: 81.0.416.53
Firefox: 86.0.1
Firefox Nightly: 76.0a1
Safari: 14.0.3
npmPackages:
@sveltejs/kit: 1.0.0-next.180 => 1.0.0-next.180
svelte: 3.43.1 => 3.43.1
Severity
serious, but I can work around it
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels