Trying to follow the instructions for building-with-rollup triggers multiple errors:
"While loading the Rollup configuration from "rollup.config.js", Node tried to require an ES module from a CommonJS file"
Solution: Rename rollup.config.js to rollup.config.mjs
"The requested module '@web/rollup-plugin-html' does not provide an export named 'default'"
Solution:
import { rollupPluginHTML as html } from "@web/rollup-plugin-html";
The requested module '@rollup/plugin-terser' does not provide an export named 'terser'
Solution:
import terser from '@rollup/plugin-terser';
TypeError: minifyHTML is not a function
Solution:
import pkgMinifyHTML from 'rollup-plugin-minify-html-literals';const minifyHTML = pkgMinifyHTML.default
Which package(s) are affected?
Lit Core (lit / lit-html / lit-element / reactive-element)
Description
Trying to follow the instructions for building-with-rollup triggers multiple errors:
"While loading the Rollup configuration from "rollup.config.js", Node tried to require an ES module from a CommonJS file" Solution: Rename
rollup.config.js
torollup.config.mjs
"The requested module '@web/rollup-plugin-html' does not provide an export named 'default'" Solution:
import { rollupPluginHTML as html } from "@web/rollup-plugin-html";
The requested module '@rollup/plugin-terser' does not provide an export named 'terser' Solution:
import terser from '@rollup/plugin-terser';
TypeError: minifyHTML is not a function Solution:
import pkgMinifyHTML from 'rollup-plugin-minify-html-literals';
const minifyHTML = pkgMinifyHTML.default
Reproduction
Follow the instructions at building-with-rollup
Workaround
See above
Is this a regression?
No or unsure. This never worked, or I haven't tried before.
Affected versions
2.x
Browser/OS/Node environment
node v20.11.0 npm 10.2.4