Subscribe on changes!

Whitespace preserve does not work

avatar
Feb 24th 2023

Vue version

3.2.37

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-9bf2b5

Steps to reproduce

Check vite.config.ts, you will find that template.compilerOptions.whitespace: 'preserve' is set.

Then look at App.vue and the output.

What is expected?

I is my understanding that with whitespace: 'preserve' the output should be

image

or at least it should be easily possible to change the template so that it is.

What is actually happening?

The output is

image

and I have found no obvious way to get the desired output.

I have tried

  • adding a second <span> with a space in it
  • adding a <slot> </slot> with a space in it (found that on StackOverflow)
  • adding &#32; after the span
  • adding a space inside the <span> (which wouldn't be the desired result anyway but it doesn't change the output at all)

System Info

StackBlitz

Any additional comments?

I believe the whitespace: 'preserve' functionality was added in https://github.com/vuejs/core/pull/1600.

avatar
Feb 26th 2023
avatar
Feb 28th 2023

Is this the same issue? #7542 @edison1105

avatar
Feb 28th 2023

@baiwusanyu-c No, this one is about preserving whitespace.