@lwc/module-resolver
9.5.3 · 27 Oct 2026MIT332.8k / weekRepositoryHomepagenpmAtom feed
499 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 8.x
8.0.0
6 Sep 2024Due to the way decorators are implemented in TypeScript, the type of the prop cannot be inferred from the wire adapter; you must provide an explicit type.
To get the most accurate validation of your types, use
constassertions on your config object. Without aconstassertion, the type system cannot distinguish between a reactive prop (e.g."$authorName") and a regular string (e.g."Codey the Bear"). As a consequence, all values of typestringare not type checked.Due to the above constraints, the reported type errors can appear complex and hard to understand. They typically boil down to validating that your config object and prop type both match the type expected by the wire adapter.
What's Changed
The breaking changes in this release only impact TypeScript users; there is no change in runtime behavior, as compared to v7.2.6.
Important
TypeScript's
experimentalDecoratorsis no longer supported; you must either specify"experimentalDecorators": falseor remove the option from your TSConfig.This release contains changes to the type signature of the
@wiredecorator, to enable better type checking of the provided values. Given@wire(adapter, config) prop, the types ofconfigandpropnow must match the types used byadapter. The type checking also successfully resolves reactive props (string starting with$) to the type used by the component.In the example below, the component passes type checking with LWC v7, but has three new type errors in LWC v8.
type Config = { id: number } type Book = { title: string, author: string } declare const getBook: WireAdapterConstructor<Config, Book> class Component extends LightningElement { bookId = 123 authorName = 'Codey the Bear' // Valid: simple case @wire(getBook, { id: 123 }) valid?: Book // Valid: `bookId` on the component is a number @wire(getBook, {id: '$bookId'} as const) validReactiveProp?: Book // Invalid: `Author` is not `Book` @wire(getBook, { id: 123 }) invalidPropType?: Author // Invalid: `true` is not a number @wire(getBook, { id: true }) invalidConfigType: Book // Invalid: `authorName` prop on the component is not a number @wire(getBook, {id: '$authorName'} as const) invalidReactiveProp?: BookLimitations
Due to the way decorators are implemented in TypeScript, the type of the prop cannot be inferred from the wire adapter; you must provide an explicit type.
To get the most accurate validation of your types, use
constassertions on your config object. Without aconstassertion, the type system cannot distinguish between a reactive prop (e.g."$authorName") and a regular string (e.g."Codey the Bear"). As a consequence, all values of typestringare not type checked.For example, for a config of type
{id: number}, providing the object{id: "123"}will pass validation, but{id: "123"} as constwill not.
Due to the above constraints, the reported type errors can appear complex and hard to understand. They typically boil down to validating that your config object and prop type both match the type expected by the wire adapter.
- 7.x
7.2.6
5 Sep 2024template-compiler: static-optimize on event listener object
What's Changed
template-compiler: static-optimize on event listener object
7.2.5
4 Sep 2024engine: Avoid invalid scope tokens entirely
What's Changed
engine: Avoid invalid scope tokens entirely
7.2.4
4 Sep 2024engine: Avoid non-string scope tokens
What's Changed
engine: Avoid non-string scope tokens
7.2.3
30 Aug 2024template-compiler: Escape tag names
template-compiler: Escape attribute names
What's Changed
template-compiler: Escape tag names
template-compiler: Escape attribute names
7.2.2
21 Aug 2024engine-core: Reduce fragment cache objects
Fix light dom slot forwarding bug
What's Changed
engine-core: Reduce fragment cache objects
Fix light dom slot forwarding bug
7.2.1
1 Aug 2024Optimize scoped ID for light/native
Improve error for null/undefined iter values
engine-core: Optimize
getStylesheetsContent
What's Changed
Optimize scoped ID for light/native
Improve error for null/undefined iter values
engine-core: Optimize
getStylesheetsContentrollup-plugin: Add
@lwc/shareddepAdd flag to disable synthetic shadow
7.2.0
24 Jul 2024Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.
7.1.5
10 Oct 2024engine-core: Gated slot forwarding fix
What's Changed
engine-core: Gated slot forwarding fix
7.1.4
5 Sep 2024Backport several validation fixes
What's Changed
Backport several validation fixes
7.1.3
13 Aug 2024Revert "prevent prematurely cloning light dom slot vnodes"
What's Changed
Revert "prevent prematurely cloning light dom slot vnodes"
7.1.2
17 Jul 2024hydration: Only ignore mutated host attributes
What's Changed
hydration: Only ignore mutated host attributes
7.1.1
17 Jul 2024Do not error if abort controller for stylesheet does not exist @W-16189944
Optimize initial render for nullish class
What's Changed
Do not error if abort controller for stylesheet does not exist @W-16189944
Optimize initial render for nullish class
7.1.0
10 Jul 2024engine-dom: Warn for
insertBeforewith 1 argAdd
data-lwc-host-mutatedduring SSR
What's Changed
engine-dom: Warn for
insertBeforewith 1 argAdd
data-lwc-host-mutatedduring SSR
7.0.5
9 Jul 2024perf-benchmarks: Add
parseHTMLUnsafepolyfilltemplate-compiler: Remove v6 engine support
What's Changed
perf-benchmarks: Add
parseHTMLUnsafepolyfilltemplate-compiler: Remove v6 engine support
7.0.4
8 Jul 2024Reading the note…
7.0.3
3 Jul 2024Reading the note…
7.0.2
2 Jul 2024Reading the note…
7.0.1
28 Jun 2024Reading the note…
7.0.0
19 Jun 2024- breaking
Booleans, numbers, and functions are no longer directly stringified, but are stripped instead.
- breaking
Arrays and objects are no longer stringified, but instead follow class object binding semantics.
- breaking
LWC v7.0.0 contains breaking changes. Please read carefully below if you are upgrading from v6.
If you are upgrading from v5, please upgrade to v6 first.
Note
LWC v7 corresponds to Salesforce release Winter '25 (API version 62).
New features
Class object binding for more ergonomic
classes in templatesthis.stylefor a more ergonomic way to change component styles at runtimethis.hostElementfor an alternative tothis.template.hostthat works in light DOM
Breaking changes
Class object binding
Note
On the Salesforce Lightning platform, this change only applies to components with an API version of 62 or above.
Class object binding is a new feature that makes it more ergonomic to render
classattributes in your LWC components. As part of this feature,classrendering has changed for some uncommon use cases.If you are using a dynamic
classin your template:<template> <div class={myClass}></div> </template>Then the rendering of this
classmay change if you were previously definingmyClassas something other than a string,null, orundefined.For example, consider if
myClassis a boolean:export default class extends LightningElement { myClass = false }Old behavior:
This renders:
<div class="false"></div>
New behavior:
<div class=""></div>
This change applies to booleans, numbers, functions, arrays, and objects. Below is a table summarizing the change:
Type Example Rendered (old) Rendered (new) Boolean trueclass="true"class=""Number 1class="1"class=""Function () => {}class="() => {}"class=""Array ["a", "b"]class="a,b"class="a b"Object { a: true }class="[object Object]"class="a"In short:
- breaking
Booleans, numbers, and functions are no longer directly stringified, but are stripped instead.
- breaking
Arrays and objects are no longer stringified, but instead follow class object binding semantics.
This may break a component if it is using a CSS selector like these:
.false {} .true {} [class="1"] {}Or if it is using
querySelectoror other traversal techniques that rely on the class name:this.template.querySelector('.false') this.template.querySelector('.true') this.template.querySelector('[class="1"]')In rare cases, this can also cause breakages across component boundaries. For example, if you have a global stylesheet relying on light DOM or synthetic shadow DOM, and thus the ability to pierce inside of components you don't own, then the above CSS selectors would break in that case as well.
To resolve any breakages:
- breaking
- breaking
In cases where you want to render a value as a string (e.g.
class="false"orclass="1"), convert it to a string usingString(value).
This change may also require updating snapshots, e.g. in Jest tests.
New this.style property
Note
On the Salesforce Lightning platform, this change only applies to components with an API version of 62 or above.
Components can now access their
CSSStyleDeclarationusingthis.style:renderedCallback() { this.style.color = 'red' }This is a breaking change if the component uses
this.styleas an expando:renderedCallback() { if (!this.style) { this.style = "foo" } }In the above case, the component author may assume that
this.styleis initiallyundefined, and then set it to a new value ("foo"). After this change, the above code will not work as expected, becausethis.styleis initially truthy rather thanundefined.To resolve this, set a class property on the component, initialized to
undefined, rather than using an expando:+ style = undefined renderedCallback() { if (!this.style) { this.style = "foo" } }You may also rename your
this.styleexpando to something else (e.g.this.customStyle).New this.hostElement property
Note
On the Salesforce Lightning platform, this change only applies to components with an API version of 62 or above.
Components can now access
this.hostElementas a convenient alternative tothis.template.host:renderedCallback() { console.log(this.template.host) // <x-component> console.log(this.hostElement) // <x-component> }Additionally, this works in light DOM components to access the "host" element (similar to the
:hostCSS pseudo-class in light DOM scoped styles). This provides an ergonomic way to access the rootHTMLElementobject in either light DOM or shadow DOM components.Similar to the new
this.styleproperty, this is a breaking change if you are usingthis.hostElementalready as an expando. Refer to thethis.stylerelease notes for a resolution.Improved TypeScript types
Note
This change only applies to component authors using TypeScript, which is not yet fully supported.
The TypeScript definitions for the
lwcpackage are greatly improved, to more closely match the ground truth of the actual APIs forLightningElement,createElement, etc. at runtime. You may need to adjust your TypeScript code or version to adapt to the new typings.Summary
- breaking
The minimum supported version of TypeScript is v5.4.5.
- breaking
The only supported compiler target is
"ESNext". - breaking
ContextValuehas been renamed toWireContextValue. - breaking
ContextConsumerhas been renamed toWireContextConsumer. - breaking
Contextualizerhas been renamed toWireContextProvider. - breaking
StylesheetFactoryhas been renamed toStylesheet. - breaking
StylesheetFactorieshas been renamed toStylesheets. - breaking
StringKeyedRecordhas been removed. Instead, use the typeRecord<string, any>. - breaking
ShadowSupportModehas been removed. Instead, use the string values"any","reset", or"native". - breaking
WireAdapteris now a generic type with a default type parameter. - breaking
WireAdapterConstructoris now a generic type with a default type parameter. - breaking
All decorators can now be used with the new decorator implementation introduced in TypeScript v5 as well as the old, experimental implementation.
- breaking
this.templateis now possibly null, reflecting the state for components using light DOM. - breaking
this.template.hostin aLightningElementis now typed asHTMLElement, rather than the broaderElement. - breaking
The return type of
createElementhas been updated to reflect the fact that the element created contains the@api-decorated props from the component definition.A new helper type,
LightningHTMLElement, has been introduced to provide an easy way of accessing the return type.const cmp: LightningHTMLElement<MyComponent> = createElement('my-component', { is: MyComponent });WARNING: Due to limitations of TypeScript, this new type incorrectly contains all props defined on the component, not just decorated props. Only decorated props are accessible at runtime.
- breaking
Importing from
"lwc"now provides module definitions for HTML/CSS imports. The module definitions are also available by directly importing a new package,@lwc/types.
Common breakages and fixes
Breakage Fix HTML imports ( import myComponent from './my-component.html')Import @lwc/typesorlwc/typessomewhere in your project. I.e.:import '@lwc/types'.StringKeyedRecordReplace with Record<string, any>or similar.ContextValueRenamed to WireContextValue, but it's really justRecord<string, any>, so you could use a more precise type instead.ContextConsumerRenamed to WireContextConsumerContextualizerRenamed to WireContextProvidercreateElementUse type assertion to cast to HTMLElement & MyComponentApiDecoratedProps. You have to define your own interface to get the@apidecorated props, because TypeScript can't detect that. (You can use your component class, but that includes all component andLightningElementprops, not just component@apidecorated props, so it's not ideal.)this.templateis possibly undefinedUse optional chaining ( ?.) or non-null assertion (!.)Cannot find name ClassMemberDecoratorContext(or other decorator type)Use TypeScript v5.4.5 Other type errors? Use TypeScript v5.4.5 @lwc/template-compiler API changes
Note
This change only affects direct consumers of the
@lwc/template-compilernpm package, who are using thecompileAPI.Due to a refactoring of the
@lwc/compilerand@lwc/template-compilerpackages, the@lwc/template-compilercompilefunction now requires the component's file name (i.e. thenamespaceandnameoptions) when compiling the template.To resolve the breaking change, add the new options. For example:
import { compile } from '@lwc/template-compiler' compile({ ...previousOptions, // Assuming the component is `<x-foo>`: namespace: 'x', name: 'foo', })What's Changed
lightning-element: Expose hostElement property
Put
this.hostElementbehind API version 62Allow access to host CSSStyleDeclaration via this.style
Template class object binding
types: Update types for v7
- 6.x
6.7.2
14 Jun 2024Reading the note…
6.7.1
12 Jun 2024Reading the note…
6.7.0
11 Jun 2024Expose the registered component class as a const declaration to allow hmr hooks for class @W-15890472
Skip hydration validation when static parts have static classes
6.6.7
10 Jun 2024Reading the note…
6.6.6
5 Jun 2024Reading the note…
6.6.5
30 May 2024Reading the note…
6.6.4
24 May 2024Reading the note…
6.6.3
8 May 2024Reading the note…
6.6.2
3 May 2024Reading the note…
6.6.1
1 May 2024Reading the note…
6.6.0
29 Apr 2024Lwc compiler errors on .jsx/.tsx files
New compiler targeting SSR
playground: Add important features to playground @W-15545976
What's Changed
Lwc compiler errors on .jsx/.tsx files
New compiler targeting SSR
playground: Add important features to playground @W-15545976
6.5.3
23 Apr 2024Reading the note…
6.5.2
17 Apr 2024Reading the note…
6.5.1
11 Apr 2024Reading the note…
6.5.0
30 Mar 2024Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.
6.4.5
5 Jun 2024Reading the note…
6.4.4
30 May 2024Reading the note…
6.4.3
30 May 2024Reading the note…
6.4.2
24 May 2024Reading the note…
6.4.1
28 Mar 2024Reading the note…
6.4.0
28 Mar 2024Apply static parts optimization to dynamic attributes
Fix iframe onload with static content optimization
Remove unnecessary nullish coalescing
Observable changes
HTML elements with
classandstyleattributes may render with additional whitespace. This is due to an optimization to improve the render time of Lightning Web Components.This change is exactly the same as what we've reported in previous releases, and can be fixed by avoiding anti-patterns for styling components. E.g.:
/* Don’t do this */ document.querySelector('[class="highlight yellow"]'); /* Do this instead */ document.querySelector(".highlight.yellow");The difference now is that this change may be seen in more components than before.
What's Changed
Apply static parts optimization to dynamic attributes
Fix iframe onload with static content optimization
Remove unnecessary nullish coalescing
Apply static parts optimization to dynamic style
synthetic-shadow: Optimize recursivelySetShadowResolver
template-compiler: Support
keyin static contentOptimize
createUpgradableConstructorApply static parts optimization to dynamic class attributes
Support arguments for FACE callbacks
engine-core: Fix warnings for invalid keys
engine-core: Optimize
patchClassAttributeError accessing tagName on fragment
Apply static parts optimization to dynamic text
Children and childNodes not returning top-level slotted children
Add signals as dependency
6.3.4
19 Mar 2024Reading the note…
6.3.3
15 Mar 2024Reading the note…
6.3.2
12 Mar 2024Reading the note…
6.3.1
8 Mar 2024Reading the note…
6.3.0
7 Mar 2024template-compiler: Avoid mutating the ast when binding complex template expressions
Event listener not being invoked for native web components
Support generating inlined sourcemaps when transforming js file…
What's Changed
template-compiler: Avoid mutating the ast when binding complex template expressions
Event listener not being invoked for native web components
Support generating inlined sourcemaps when transforming js file…
template-compiler: Avoid discarding text content whitespace for complex expressions
6.2.1
28 Feb 2024Reading the note…
6.2.0
21 Feb 2024Signals implementation v1
Add reporting for shadowSupportMode
Add default exports to
lwc@W-13710298
Contains signal implementation in LWC and a few other bug fixes.
What's Changed
Signals implementation v1
Add reporting for shadowSupportMode
Add default exports to
lwc@W-13710298
6.1.1
6 Feb 2024Reading the note…
6.1.0
2 Feb 2024Use more helpful error message for invalid render() return value @W-14785069
Allow computed properties in @wire if they are constants or primitives @W-14785085
What's Changed
Use more helpful error message for invalid render() return value @W-14785069
Allow computed properties in @wire if they are constants or primitives @W-14785085