Skip to content

Commit f615dd6

Browse files
committed
add optimizeSSR option + improve option docs in sidebar
1 parent c8cf57d commit f615dd6

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

docs/en/SUMMARY.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@
1919
- [Testing](workflow/testing.md)
2020
- [Testing with Mocks](workflow/testing-with-mocks.md)
2121
- [Options Reference](options.md)
22+
- [loaders](options.md#loaders)
23+
- [preLoaders](options.md#preloaders)
24+
- [postLoaders](options.md#postloaders)
25+
- [postcss](options.md#postcss)
26+
- [cssSourceMap](options.md#csssourcemap)
27+
- [esModule](options.md#esmodule)
28+
- [preserveWhitespace](options.md#preservewhitespace)
29+
- [transformToRequire](options.md#transformtorequire)
30+
- [buble](options.md#buble)
31+
- [extractCSS](options.md#extractcss)
32+
- [optimizeSSR](options.md#optimizessr)

docs/en/options.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ module.exports = {
114114

115115
### cssSourceMap
116116

117-
- type: `Boolean`
117+
- type: `boolean`
118118
- default: `true`
119119

120120
Whether to enable source maps for CSS. Disabling this can avoid some relative path related bugs in `css-loader` and make the build a bit faster.
@@ -123,14 +123,14 @@ module.exports = {
123123

124124
### esModule
125125

126-
- type: `Boolean`
127-
- default: `undefined`
126+
- type: `boolean`
127+
- default: `false`
128128

129129
Whether to emit esModule compatible code. By default vue-loader will emit default export in commonjs format like `module.exports = ....`. When `esModule` is set to true, default export will be transpiled into `exports.__esModule = true; exports = ...`. Useful for interoperating with transpiler other than Babel, like TypeScript.
130130

131131
### preserveWhitespace
132132

133-
- type: `Boolean`
133+
- type: `boolean`
134134
- default: `true`
135135

136136
If set to `false`, the whitespaces between HTML tags in templates will be ignored.
@@ -190,6 +190,9 @@ module.exports = {
190190

191191
> New in 12.0.0
192192
193+
- type: `boolean`
194+
- default: `false`
195+
193196
Automatically extracts the CSS using `extract-text-webpack-plugin`. Works for most pre-processors out of the box, and handles minification in production as well.
194197

195198
The value passed in can be `true`, or an instance of the plugin (so that you can use multiple instances of the extract plugin for multiple extracted files).
@@ -246,3 +249,12 @@ module.exports = {
246249
]
247250
}
248251
```
252+
253+
### optimizeSSR
254+
255+
> New in 12.1.1
256+
257+
- type: `boolean`
258+
- default: `true` when the webpack config has `target: 'node'` and `vue-template-compiler` is at version 2.4.0 or above.
259+
260+
Enable Vue 2.4 SSR compilation optimization that compiles part of the vdom trees returned by render functions into plain strings, which improves SSR performance. In some cases you might want to explicitly turn it off because the resulting render functions can only be used for SSR and cannot be used for client-side rendering or testing.

lib/template-compiler/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = function (html) {
2626
scopedId: options.id
2727
}
2828

29-
var compile = isServer && compiler.ssrCompile
29+
var compile = isServer && compiler.ssrCompile && vueOptions.optimizeSSR !== false
3030
? compiler.ssrCompile
3131
: compiler.compile
3232

0 commit comments

Comments
 (0)