Skip to content

svelte-preprocess generate invalid CSS #191

@wighawag

Description

@wighawag

Describe the bug
svelte-preprocess generate invalid CSS when a global style include valid css using backslash

see sveltejs/svelte#5078

Logs

from https://github.com/wighawag/svelte-css-parser-error/

$ rollup -c

src/main.js → public/build/bundle.js...
[!] (plugin svelte) ParseError: RightParenthesis is expected
src\App.svelte
178:    );
179:    --color-icon: var(--color-positive-normal-muted);
180:  }
       ^
181:  </style>
182:
ParseError: RightParenthesis is expected
    at error (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\svelte\src\compiler\utils\error.ts:25:16)
    at Parser$1.error (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\svelte\src\compiler\parse\index.ts:93:3)
    at Object.read_style [as read] (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\svelte\src\compiler\parse\read\style.ts:21:11)
    at tag (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\svelte\src\compiler\parse\state\tag.ts:190:27)
    at new Parser$1 (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\svelte\src\compiler\parse\index.ts:45:12)
    at parse (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\svelte\src\compiler\parse\index.ts:208:17)
    at compile (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\svelte\src\compiler\compile\index.ts:79:14)
    at C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\rollup-plugin-svelte\index.js:252:22
    at ModuleLoader.addModuleSource (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\rollup\dist\shared\rollup.js:17749:30)
    at ModuleLoader.fetchModule (C:\dev\projects\wighawag\svelte-css-parser-test-2\node_modules\rollup\dist\shared\rollup.js:17803:9)

To Reproduce

git clone https://github.com/wighawag/svelte-css-parser-error/
cd svelte-css-parser-error
yarn && yarn build

Expected behavior
should build succesfully with valid css in <style global > </style> tags

Stacktraces

see log above

Information about your Svelte project:

  • Your operating system: Windows 10

  • Svelte version : 3.23.2

  • Whether your project uses Webpack or Rollup : Rollup

Severity
It block me from using css library like a17t so pretty severe in my opinion

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingnext-majorwill be fixed in the next major

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions