-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client-side rendered template adds additional Carriage Return characters to DOM #9207
Comments
Please, take the time to provide a boiled down repro when you report a bug. Closing until one is provided |
@posva how can I provide repro with build step with SSR? |
a boiled down repository that can showcase the problem with |
@posva will do that later today - thought you meant something like JSFiddle or CodeSandbox. |
yeah, no pressure, whenever you can is fine! |
@posva, here's the minimal repro: https://github.com/DominikSerafin/repro-9207 Instructions:You can start development with hot reload using To build bundles for production use To run server in production mode using built bundles use After you start it, you can check console - I've included there debug log comparing escaped innerHTML of affected element before and after hydration. |
Just checked the repro, it's still too big for a Vue bug 😅 Does it only happens with vue loader? |
Hi @posva thanks for taking time to check this. I played with it a little bit more today, and it seems that either one of these two things fixes this problem:
https://github.com/vuejs/vue-hackernews-2.0/blob/master/build/webpack.server.config.js#L13 Which I similarly did myself: But... today while trying to debug this, I also added this to my client config, then this issue also has been fixed (even with saved/commited CRLF endings). I'm not very familiar with what exactly webpack setting |
Version
vue: 2.5.21
vue-server-renderer: 2.5.21
vue-template-compiler: 2.5.21
vue-loader: 15.4.2
webpack: 4.27.1
@babel/core: 7.2.0
@babel/plugin-transform-runtime: 7.2.0
@babel/preset-env: 7.2.0
(I'm not sure, but I think this problem was non-existent when I was using vue-loader@13)
Reproduction link
(Needs build step)
Steps to reproduce
What is expected?
Line feeds, carriage returns and whitespaces should be removed from the compiled template. Like here: https://vuejs.org/v2/guide/render-function.html#Template-Compilation
Hydration doesn't add additional carriage return (%0D) characters to rendered content.
Visually rendered content doesn't have any unnecessary spaces.
What is actually happening?
Line feeds, carriage returns and whitespaces remain in compiled code and on top of that render differently after SSR hydration.
Hydration adds additional carriage return (%0D) characters to rendered content.
Visually rendered content has unnecessary spaces after SSR hydration (but not before).
This behavior can be observed here: https://workaline.com/collection/vue (it looks fine before hydration kicks in)
Image explaining it a little bit more:
Configs:
Note: I've tried changing vue-loader
compilerOptions.preserveWhitespace
to different values - but that didn't changed anything.webpack.base.config.js
webpack.client.config.js
webpack.server.config.js
The text was updated successfully, but these errors were encountered: