Context
I want to generate a standalone component to be loaded in a shadow DOM.
It seems that this gets me most of what I need:
- own JS chunk
- standalone CSS chunk that includes all the CSS dependencies (sub-imports of other .css files)
import shadow from 'react-shadow';
/// partial, pseudo-code
const {Component} = await import('./Component');
return <shadow.div><Component/></shadow.div>
At this point, a Component.css file is being generated and appended to document.head.
**The problem is that this stylesheet should be inside shadow.div
Feature Proposal
I'm not sure what would be the best way to achieve this, but perhaps:
- add a magic comment to the
import() to disable the automatic injection of the stylesheet
e.g. import(/* webpackCss: no-inject */ './Component');
- return the URL as an additional property, so that it can be handled autonomously
e.g. const {Component, __miniCssUrl} = await import('./Component');
Related links
Context
I want to generate a standalone component to be loaded in a shadow DOM.
It seems that this gets me most of what I need:
At this point, a
Component.cssfile is being generated and appended todocument.head.**The problem is that this stylesheet should be inside
shadow.divFeature Proposal
I'm not sure what would be the best way to achieve this, but perhaps:
import()to disable the automatic injection of the stylesheete.g.
import(/* webpackCss: no-inject */ './Component');e.g.
const {Component, __miniCssUrl} = await import('./Component');Related links