The "Build with Rollup" documentation is broken
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 142
- Forks
- 230
- PR merge metrics
- No merged PRs in 30d
Description
### Which package(s) are affected?
Lit Core (lit / lit-html / lit-element / reactive-element)
### Description
Trying to follow the instructions for [building-with-rollup](https://lit.dev/docs/tools/production/#building-with-rollup) triggers multiple errors:
1. "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`
2. "The requested module '@web/rollup-plugin-html' does not provide an export named 'default'"
[Solution](https://github.com/modernweb-dev/web/issues/1415):
`import { rollupPluginHTML as html } from "@web/rollup-plugin-html";`
3. The requested module '@rollup/plugin-terser' does not provide an export named 'terser'
[Solution](https://github.com/rollup/plugins/issues/1397):
`import terser from '@rollup/plugin-terser';`
4. TypeError: minifyHTML is not a function
[Solution](https://github.com/asyncLiz/rollup-plugin-minify-html-literals/issues/24):
`import pkgMinifyHTML from 'rollup-plugin-minify-html-literals';`
`const minifyHTML = pkgMinifyHTML.default`
### Reproduction
Follow the instructions at [building-with-rollup](https://lit.dev/docs/tools/production/#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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the building-with-rollup section of the Lit documentation and compare its rollup.config.js example with the reported Node, @web/rollup-plugin-html, @rollup/plugin-terser, and rollup-plugin-minify-html-literals errors. Reproduce the instructions with Node v20.11.0 and npm 10.2.4, then update the documented configuration so the build completes without those errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs, rollup
- Domain
- build-system, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100