Skip to content

Preprocessing a .pug-file completely with markupTagName: "" crashes  #439

@wvhulle

Description

@wvhulle

Describe the bug

While using the preprocessor for pug and trying to make the preprocessor parse the whole file, the site crashes. How can I parse a .pug file successfully?

Logs

Error: .svelte-kit/dev/generated/root.svelte:55:34
    53| 	export let props_2 = null;
    54| 
  > 55| 	setContext('__svelte__', stores);
-----------------------------------------^
    56| 
    57| 	$: stores.page.set(page);
    58| 	afterUpdate(stores.page.notify);

unexpected text ";

	$"
    at makeError (/node_modules/pug-error/index.js:34:13)
    at Lexer.error (/node_modules/pug-lexer/index.js:62:15)
    at Lexer.fail (/node_modules/pug-lexer/index.js:1629:10)
    at Lexer.advance (node_modules/pug-lexer/index.js:1694:12)
    at Lexer.callLexerFunction (/node_modules/pug-lexer/index.js:1647:23)
    at Lexer.getTokens (/node_modules/pug-lexer/index.js:1706:12)
    at lex (/node_modules/pug-lexer/index.js:12:42)
    at Object.lex (/node_modules/pug/lib/index.js:104:9)
    at Function.loadString [as string] (/dsp-app/node_modules/pug-load/index.js:53:24)
    at compileBody (/node_modules/pug/lib/index.js:82:18)

To Reproduce

Use this as svelte.config.js

import preprocess from 'svelte-preprocess';
import adapter from '@sveltejs/adapter-node';

import pkg from 'svelte-preprocess';
const {pug } = pkg;

const config = {
	extensions: ['.svelte',".pug"],
	preprocess: [
		preprocess({
			// postcss: true,
			// pug: true,
		}),
		pug({markupTagName: ""}),
	],
	kit: {
		target: '#svelte',
		adapter: adapter({ out: 'build' })
	}
};

export default config;

Load the homepage.

Expected behavior

Writing a .pug-file and have it pre-processed completely to svelte syntax.

Stacktraces
If you have a stack trace to include, we recommend putting inside a <details> block for the sake of the thread's readability:

Stack trace

Stack trace goes here...

Information about your project:

Firefox 94
Arch Linux
Node 16.11.1

Additional context

Metadata

Metadata

Assignees

Labels

invalidThis doesn't seem right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions