vue-loader
Advanced tools
Comparing version 16.7.1 to 16.8.0
@@ -0,1 +1,15 @@ | ||
# [16.8.0](https://github.com/vuejs/vue-loader/compare/v16.7.1...v16.8.0) (2021-09-22) | ||
### Bug Fixes | ||
* **hmr:** fix hmr regression ([bacc6a9](https://github.com/vuejs/vue-loader/commit/bacc6a9eeca40d6028a2d9a5f6ee02e6c8574abd)) | ||
### Features | ||
* enableTsInTemplate option ([7613534](https://github.com/vuejs/vue-loader/commit/7613534954b83489a060860b9525a0d121023c5b)) | ||
## [16.7.1](https://github.com/vuejs/vue-loader/compare/v16.7.0...v16.7.1) (2021-09-22) | ||
@@ -10,2 +24,11 @@ | ||
## [16.7.1](https://github.com/vuejs/vue-loader/compare/v16.7.0...v16.7.1) (2021-09-22) | ||
### Bug Fixes | ||
* remove pure annotation for custom blocks ([cd891e5](https://github.com/vuejs/vue-loader/commit/cd891e593bf7f8aff852f1d47fda2337de661bea)) | ||
# [16.7.0](https://github.com/vuejs/vue-loader/compare/v16.6.0...v16.7.0) (2021-09-21) | ||
@@ -12,0 +35,0 @@ |
@@ -9,7 +9,8 @@ "use strict"; | ||
if (module.hot) { | ||
script.__hmrId = "${id}" | ||
__exports__.__hmrId = "${id}" | ||
const api = __VUE_HMR_RUNTIME__ | ||
module.hot.accept() | ||
if (!api.createRecord('${id}', script)) { | ||
api.reload('${id}', script) | ||
if (!api.createRecord('${id}', __exports__)) { | ||
console.log('reload') | ||
api.reload('${id}', __exports__) | ||
} | ||
@@ -24,2 +25,3 @@ ${templateRequest ? genTemplateHotReloadCode(id, templateRequest) : ''} | ||
module.hot.accept(${request}, () => { | ||
console.log('re-render') | ||
api.rerender('${id}', render) | ||
@@ -26,0 +28,0 @@ }) |
@@ -15,4 +15,5 @@ import webpack = require('webpack'); | ||
appendExtension?: boolean; | ||
enableTsInTemplate?: boolean; | ||
isServerBuild?: boolean; | ||
} | ||
export default function loader(this: webpack.loader.LoaderContext, source: string): string | void; |
@@ -109,3 +109,3 @@ "use strict"; | ||
const attrsQuery = attrsToQuery(descriptor.template.attrs); | ||
const tsQuery = isTS ? `&ts=true` : ``; | ||
const tsQuery = options.enableTsInTemplate !== false && isTS ? `&ts=true` : ``; | ||
const query = `?vue&type=template${idQuery}${scopedQuery}${tsQuery}${attrsQuery}${resourceQuery}`; | ||
@@ -167,5 +167,2 @@ templateRequest = stringifyRequest(src + query); | ||
} | ||
if (needsHotReload) { | ||
code += (0, hotReload_1.genHotReloadCode)(id, templateRequest); | ||
} | ||
// Expose filename. This is used by the devtools and Vue runtime warnings. | ||
@@ -205,10 +202,14 @@ if (!isProduction) { | ||
if (!propsToAttach.length) { | ||
code += `\n\nexport default script`; | ||
code += `\n\nconst __exports__ = script;`; | ||
} | ||
else { | ||
code += `\n\nimport exportComponent from ${exportHelperPath}`; | ||
code += `\nexport default /*#__PURE__*/exportComponent(script, [${propsToAttach | ||
code += `\nconst __exports__ = /*#__PURE__*/exportComponent(script, [${propsToAttach | ||
.map(([key, val]) => `['${key}',${val}]`) | ||
.join(',')}])`; | ||
} | ||
if (needsHotReload) { | ||
code += (0, hotReload_1.genHotReloadCode)(id, templateRequest); | ||
} | ||
code += `\n\nexport default __exports__`; | ||
return code; | ||
@@ -215,0 +216,0 @@ } |
@@ -52,3 +52,5 @@ "use strict"; | ||
compiler: templateCompiler, | ||
compilerOptions: Object.assign(Object.assign({}, options.compilerOptions), (0, util_1.resolveTemplateTSOptions)(descriptor, options.compilerOptions)), | ||
compilerOptions: Object.assign(Object.assign({}, options.compilerOptions), (options.enableTsInTemplate | ||
? (0, util_1.resolveTemplateTSOptions)(descriptor, options.compilerOptions) | ||
: null)), | ||
transformAssetUrls: options.transformAssetUrls || true, | ||
@@ -55,0 +57,0 @@ }, |
@@ -51,3 +51,5 @@ "use strict"; | ||
compiler: templateCompiler, | ||
compilerOptions: Object.assign(Object.assign(Object.assign({}, options.compilerOptions), { scopeId: query.scoped ? `data-v-${scopeId}` : undefined, bindingMetadata: script ? script.bindings : undefined }), (0, util_1.resolveTemplateTSOptions)(descriptor, options.compilerOptions)), | ||
compilerOptions: Object.assign(Object.assign(Object.assign({}, options.compilerOptions), { scopeId: query.scoped ? `data-v-${scopeId}` : undefined, bindingMetadata: script ? script.bindings : undefined }), (options.enableTsInTemplate | ||
? (0, util_1.resolveTemplateTSOptions)(descriptor, options.compilerOptions) | ||
: null)), | ||
transformAssetUrls: options.transformAssetUrls || true, | ||
@@ -54,0 +56,0 @@ }); |
{ | ||
"name": "vue-loader", | ||
"version": "16.7.1", | ||
"version": "16.8.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Evan You", |
@@ -12,5 +12,12 @@ # vue-loader [![ci](https://github.com/vuejs/vue-loader/actions/workflows/ci.yml/badge.svg?branch=next)](https://github.com/vuejs/vue-loader/actions/workflows/ci.yml) | ||
- `customElement: boolean | RegExp`: enable custom elements mode. An SFC loaded in custom elements mode inlines its `<style>` tags as strings under the component's `styles` option. When used with `defineCustomElement` from Vue core, the styles will be injected into the custom element's shadow root. | ||
- Default is `/\.ce\.vue$/` | ||
- Setting to `true` will process all `.vue` files in custom element mode. | ||
- `enableTsInTemplate: boolean` (16.8+): allow TS expressions in templates when `<script>` has `lang="ts"`. Defaults to `true`. | ||
- When used with `ts-loader`, due to `ts-loader`'s cache invalidation behavior, it sometimes prevents the template from being hot-reloaded in isolation, causing the component to reload despite only the template being edited. If this is annoying, you can set this option to `false` (and avoid using TS expressions in templates). | ||
- Alternatively, leave this option on (by default) and use [`esbuild-loader`](https://github.com/privatenumber/esbuild-loader) to transpile TS instead, which doesn't suffer from this problem (it's also a lot faster). However, do note you will need to rely on TS type checking from other sources (e.g. IDE or `vue-tsc`). | ||
## What is Vue Loader? | ||
@@ -17,0 +24,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75207
1170
133