docs: add Modern Web Platform guide (Web Components, Import Maps, PWA)#8140
docs: add Modern Web Platform guide (Web Components, Import Maps, PWA)#8140phoekerson wants to merge 4 commits intowebpack:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/cc @evenstensberg @avivkeller Can you take a look at this too, thanks |
|
Hello, please @alexander-akait @evenstensberg @avivkeller Can you take a look at my work ? |
Co-authored-by: Aviv Keller <me@aviv.sh>
|
@avivkeller Thank you so much. I took your suggestion into account and made the correction |
evenstensberg
left a comment
There was a problem hiding this comment.
good work. left a couple of suggestions.
|
|
||
| ### Problem | ||
|
|
||
| If more than one JavaScript bundle executes `customElements.define()` for the same tag name, the browser throws `DOMException: Failed to execute 'define' on 'CustomElementRegistry'`. That often happens when the module that registers an element is duplicated: separate entry points or async chunks each contain a copy of the registration code, so two bundles both run `define` for the same tag. |
There was a problem hiding this comment.
link to the mdn article on domexception
| export default { | ||
| entry: { | ||
| main: "./src/main.js", | ||
| admin: "./src/admin.js", |
| entry: "./src/index.js", | ||
| externalsType: "module", | ||
| externals: { | ||
| "lodash-es": "lodash-es", |
There was a problem hiding this comment.
lets add an example using cdns too
There was a problem hiding this comment.
Thanks @evenstensberg for the feedback! I've added a link to the MDN article on
DOMException in the Web Components section, and added a CDN example
(cdn.jsdelivr.net) alongside the local vendor path in the Import Maps section.
Summary
Adds a new guide — Modern Web Platform — covering three practical webpack
patterns that are frequently asked about on Discord and the issue tracker but
not yet documented in a single place:
optimization.splitChunkswithcacheGroupsto deduplicate Custom Element registrations across bundles and avoid the
DOMException: Failed to execute 'define' on 'CustomElementRegistry'runtimeerror.
externals,externalsType: "module", andexperiments.outputModuleso webpack output is compatible with browser-nativeimport map resolution.
InjectManifestfromworkbox-webpack-pluginalongside[contenthash]output filenames to keepprecache manifests in sync across builds.
Each section follows the existing guide structure: problem statement → minimal
working configuration → limitations and future work.
Note:
--no-verifywas used locally becausesrc/sw.jshas two pre-existinglint errors (
import/named) unrelated to this PR.This PR is also part of my Google Summer of Code 2026 application to webpack,
where I am proposing to implement native webpack support for these three web
platform features. This documentation reflects my research into the current
state of webpack 5 and the gaps I intend to address during GSoC.
What kind of change does this PR introduce?
docs
Did you add tests for your changes?
No — this is a documentation-only change. No code was modified.
Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or
what have you already documented?
This PR is itself the documentation. Once merged, the Modern Web Platform
guide will be accessible at /guides/modern-web-platform/ and automatically
listed in the sidebar via the build system.
Use of AI