Skip to content

Commit ea83441

Browse files
committed
feat: new option "preserveWhitespace"
1 parent f5c0f58 commit ea83441

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

docs/config.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@ module.exports = {
2929
// explicitly transpile a dependency with this option.
3030
transpileDependencies: [/* string or regex */],
3131

32+
// whether to preserve whitespaces between elements during template
33+
// compilation. Defaults to false for smaller compiled code size and
34+
// performance.
35+
preserveWhitepsace: false,
36+
3237
// tweak internal webpack configuration.
3338
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
3439
chainWebpack: () => {},
3540
configureWebpack: () => {},
3641

37-
// vue-loader options
38-
// https://vue-loader.vuejs.org/en/options.html
39-
vueLoader: {},
40-
4142
// generate sourceMap for production build?
4243
productionSourceMap: true,
4344

@@ -47,16 +48,16 @@ module.exports = {
4748
// can also be an object of options to pass to extract-text-webpack-plugin
4849
extract: true,
4950

51+
// Enable CSS modules for all css / pre-processor files.
52+
// This option does not affect *.vue files.
53+
modules: false,
54+
5055
// enable CSS source maps?
5156
sourceMap: false,
5257

5358
// pass custom options to pre-processor loaders. e.g. to pass options to
5459
// sass-loader, use { sass: { ... } }
55-
loaderOptions: {},
56-
57-
// Enable CSS modules for all css / pre-processor files.
58-
// This option does not affect *.vue files.
59-
modules: false
60+
loaderOptions: {}
6061
},
6162

6263
// use thread-loader for babel & TS in production build

packages/@vue/cli-service/lib/config/base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = (api, options) => {
4848
.loader('vue-loader')
4949
.options({
5050
compilerOpitons: {
51-
preserveWhitespace: false
51+
preserveWhitespace: options.preserveWhitespace
5252
}
5353
})
5454

packages/@vue/cli-service/lib/options.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const schema = createSchema(joi => joi.object({
55
outputDir: joi.string(),
66
compiler: joi.boolean(),
77
transpileDependencies: joi.array(),
8+
preserveWhitespace: joi.boolean(),
89
productionSourceMap: joi.boolean(),
910
parallel: joi.boolean(),
1011
devServer: joi.object(),
@@ -58,6 +59,9 @@ exports.defaults = () => ({
5859
// deps to transpile
5960
transpileDependencies: [/* string or regex */],
6061

62+
// whether to preserve whitespaces between elements
63+
preserveWhitespace: false,
64+
6165
// sourceMap for production build?
6266
productionSourceMap: true,
6367

0 commit comments

Comments
 (0)