Description
Description
The LWC Rollup plugin seems to have a fundamental incompatibility with Vite's core set of plugins (which are not configurable). The issue stems from the fact that both the LWC Rollup plugin and Vite's build-html plugin attempt to transform LWC html files into javascript assets. It doesn't matter which plugin comes first in the chain, as either will break the other because both expect to receive valid html to transform (instead of the javascript that each plugin produces).
If Vite's build-html plugin comes first, it will also complain about LWC's html files lacking a doctype tag (ie <!DOCTYPE html>
) as they typically only have a <template>
tag along with their html snippets.
Steps to Reproduce
Example Vite configuration:
export default defineConfig({
plugins: [
lwc()
]
});
Expected Results
It would be nice if this "just worked" ™️.
Actual Results
Errors such as:
RollupError: src/modules/x/app/app.ts (1:9): "default" is not exported by "src/modules/x/app/app.html", imported by "src/modules/x/app/app.ts".
[CompilerError: [rollup-plugin-lwc-compiler] LWC1072: Missing root template tag file: /Users/djunger/code/electron-forge-vite/src/modules/x/app/app.html]
Browsers Affected
N/A
Version
All versions
Possible Solution
This may require a unique plugin distinct from the existing Rollup plugin, though it could also point to systemic integration issues with the LWC platform and its pseudo html templates.
Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.
Activity