Skip to content
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

Document configuring whitespace #5394

Open
Etheryte opened this issue Apr 16, 2020 · 0 comments
Open

Document configuring whitespace #5394

Etheryte opened this issue Apr 16, 2020 · 0 comments

Comments

@Etheryte
Copy link

What problem does this feature solve?

In 2018, the whitespace compiler option was introduced with valid values of preserve and condense. This handy option gives developers control over whether to keep extra whitespaces in templates or condense them down to reduce bundle size.

With Vue CLI v4, the default value was switched, from preserve to condense. This is useful for most setups, but can be detrimental at times — in my case, when working with Markdown.

This comment on a fairly old issue covers changing the flag through the chainWebpack config field:

// vue.config.js
module.exports = {
  chainWebpack: config => {
    config.module
      .rule('vue')
        .use('vue-loader')
          .tap(args => {
            args.compilerOptions.whitespace = 'preserve'
          })
  }
}

While easy to follow when you're familiar with how Webpack is used in Vue CLI, this is far from trivial and also fairly tricky to find.

Personally I only managed to find the flag after inspecting the config with vue inspect and finding the flag name there.

What does the proposed API look like?

The configuration should be covered in the official documentation. Currently, Googling for it brings up old tickets and a migration guide, neither which immediately reveal how to change this option.

@Etheryte Etheryte changed the title Document configuring whitespace Document configuring whitespace Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants