Skip to content

emitCss: false does not work with Svelte 5 #235

@sissbruecker

Description

@sissbruecker

When using the plugin with the Svelte 5 compiler then emitCss: false is broken and the CSS source code is just stripped from the compiled code.

Reproduction:

  • Clone this repo
  • npm uninstall svelte
  • npm install svelte@^5.0.0
  • Add the following test and run npm test
  • The test fails
test('injects CSS with `emitCss: false', async () => {
	const p = plugin({emitCss: false});

	const transformed = await p.transform(
		`
			<h1>Hello!</h1>

			<style>
				h1 {
					color: red;
				}
			</style>
		`,
		'test.svelte'
	);

	assert.ok(transformed.code.includes('color:red'));
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions