question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option preserveWhitespace still not working

See original GitHub issue

Ref https://github.com/JeffreyWay/laravel-mix/issues/1753

Any idea why this is still not working? I still see whitespaces between dom elements…

https://vue-loader-v14.vuejs.org/en/options.html#preservewhitespace

mix.options({
   vue: {
      preserveWhitespace: false
   }
})
-> % npm list|grep vue           
..
├── vue@2.6.11
..

-> % npm list|grep vue-loader
│ ├─┬ vue-loader@15.8.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
fidelopercommented, Feb 2, 2022

I couldn’t get this to work in the webpack config, however I did get it working.

For Vue3, Following the docs here: https://v3.vuejs.org/api/application-config.html#compileroptions-whitespace

I updated my resources/js/app.js:

require('./bootstrap');

import { createApp } from 'vue'
import HelloWorld from './components/Welcome'

const app = createApp({})

// The magic is here:
app.config.compilerOptions.whitespace = 'preserve'

app.component('hello-world', HelloWorld)
app.mount('#app')

1reaction
Eldaircommented, Sep 24, 2021

Hi,

preserveWhitespace is deprecated and new option is whitespace This is the new syntax:

mix.options({
    vue: {
        compilerOptions: {
            whitespace: 'preserve',
        },
    },
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Option preserveWhitespace still not working #2463 - GitHub
Any idea why this is still not working? I still see whitespaces between dom elements.. https://vue-loader-v14.vuejs.org/en/options.html# ...
Read more >
How to globally set the preserveWhitespaces option in ...
I've seen the PR, but from what I can tell from some tests is that the only way to use it is to...
Read more >
XDocument.Parse Method (System.Xml.Linq) - Microsoft Learn
Creates a new XDocument from a string, optionally preserving white space, setting the base URI, and retaining line information.
Read more >
DOMDocument - Manual - PHP
Last child element or null . preserveWhiteSpace. Do not remove redundant white space. Default to true . Setting this to false has the...
Read more >
Option to preserve whitespace for autoformat for XML element ...
What steps will reproduce the issue? Create a simple XML document: <a> <b>foo bar</b> </a>. XML. Reformat the file via IDEA.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found