sidebar |
---|
auto |
-
type:
{ [tag: string]: string | Array<string> }
-
default:
{ video: ['src', 'poster'], source: 'src', img: 'src', image: 'xlink:href' }
During template compilation, the compiler can transform certain attributes, such as
src
URLs, intorequire
calls, so that the target asset can be handled by webpack. For example,<img src="./foo.png">
will attempt to locate the file./foo.png
on your file system and include it as a dependency of your bundle.
-
Type:
VueTemplateCompiler
-
default:
require('vue-template-compiler')
Override the default compiler used to compile
<template>
blocks in single file components.
-
type:
Object
-
default:
{}
Options for the template compiler. When using the default
vue-template-compiler
, you can use this option to add custom compiler directives, modules, or discard whitespaces between template tags with{ preserveWhitespace: false }
.
-
type:
Object
-
default:
{}
Configure ES2015+ to ES5 transpiling options for the generated render function code. The transpiler is a fork of Buble, so consult the available options here.
The template render functions compilation supports a special transform
stripWith
(enabled by default), which removes thewith
usage in generated render functions to make them strict-mode compliant.
-
type:
boolean
-
default:
true
when the webpack config hastarget: 'node'
andvue-template-compiler
is at version 2.4.0 or above.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.
-
type:
boolean
-
default:
true
in development mode,false
in production mode or when the webpack config hastarget: 'node'
. -
allowed value:
false
(true
will not force Hot Reload neither in production mode nor whentarget: 'node'
)Whether to use webpack Hot Module Replacement to apply changes in the browser without reloading the page. Use this option (value
false
) to disable the Hot Reload feature in development mode.
- type:
boolean
- default:
process.env.NODE_ENV === 'production'
Force production mode, which prohibits the loader from emitting code (e.g. hot-reload related code) that is development-only.
- type:
boolean
- default:
false
Compiled the component for usage inside Shadow DOM. In this mode, the styles of the component will be injected into this.$root.$options.shadowRoot
instead of the document head.
- type:
string
- default:
undefined
When both options are specified, enables file-system-based template compilation caching (requires cache-loader
to be installed in the same project).
::: tip
Interaction between vue-loader
and cache-loader
uses inline loader import syntax under the hook, the !
will be treated as the separator between different loaders, so please ensure cacheDirectory
doesn't contain !
.
:::