You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As TypeScript is not fully supported by LWC and the LWC rollup plugin we need to use Babel to remove the TypeScript annotation before the LWC rollup plugin can process it. This works fine when we have discrete components that implement both the javascript class and the html template.
The problem only occurs when we have one LWC component extending another LWC component and inheriting the html template from the parent component. Rollup throws an error that the template file cannot be found. It tries to find the html template for the child component instead of trying to load the template from the parent component.
This issue only happens when using TypeScript.
On the playground repro below you will see the error message ENOENT: no such file or directory, open '/home/projects/salesforce-lwc-k2agyu/src/test/btnExtended/btnExtended.html'.
I have created a workaround rollup plugin with the hardcoded path for the correct template as in the code snippet below.
If you uncomment those lines in the rollup config on the playground below the error goes away and the example works.
[!] Error: Could not load /home/projects/salesforce-lwc-k2agyu/src/test/btnExtended/btnExtended.html (imported by src/test/btnExtended/btnExtended.ts): ENOENT: no such file or directory, open '/home/projects/salesforce-lwc-k2agyu/src/test/btnExtended/btnExtended.html'
Browsers Affected
N/A
Version
Node 18.20.3
LWC: 6.6.3
rollup: 3.28.0
@rollup/plugin-babel: 6.0.4
Possible Solution
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
The text was updated successfully, but these errors were encountered:
…cript file @W-15941938 (#4261)
* fix(rollup-plugin): allow any implicit HTML import from any kind of script file
Fixes#4233
* refactor(rollup-plugin): use list of file extensions instead of regex
* feat(transformer): allow .mts and .mjs file extensions
It will land in our next release, which will be either v6.6.7 or v6.7.0. I haven't checked what else we have slated for release, so I don't know if it will be a patch or minor version bump.
Description
As TypeScript is not fully supported by LWC and the LWC rollup plugin we need to use Babel to remove the TypeScript annotation before the LWC rollup plugin can process it. This works fine when we have discrete components that implement both the javascript class and the html template.
The problem only occurs when we have one LWC component extending another LWC component and inheriting the html template from the parent component. Rollup throws an error that the template file cannot be found. It tries to find the html template for the child component instead of trying to load the template from the parent component.
This issue only happens when using TypeScript.
On the playground repro below you will see the error message
ENOENT: no such file or directory, open '/home/projects/salesforce-lwc-k2agyu/src/test/btnExtended/btnExtended.html'
.I have created a workaround rollup plugin with the hardcoded path for the correct template as in the code snippet below.
If you uncomment those lines in the rollup config on the playground below the error goes away and the example works.
Steps to Reproduce
https://stackblitz.com/edit/salesforce-lwc-k2agyu?file=rollup.config.mjs
Expected Results
No errors are thrown and the components work.
Actual Results
Rollup throws the error:
Browsers Affected
N/A
Version
Possible Solution
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
The text was updated successfully, but these errors were encountered: