You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// src/pages/index.astro
---
import {Foo} from '../components';
---
<Foo/>
That index page will include the styles and client-side scripts from the Bar component.
While this is not fixed in Astro core, it could be provided as a virtual import that dynamically (and lazily) expands into the powerset of possible imports.
For the example above:
import {Foo} from '~anyComponent'; would resolve to a module containing:
exportFoofrom'/src/components/Foo.astro';
import {Bar} from '~anyComponent'; would resolve to a module containing:
exportBarfrom'/src/components/Bar.astro';
import {Foo, Bar} from '~anyComponent'; would resolve to a module containing:
Barrel files in Astro cause the styles and scripts from all the re-exported components to be included in any page that uses any one of them.
Then on a page:
That index page will include the styles and client-side scripts from the
Bar
component.While this is not fixed in Astro core, it could be provided as a virtual import that dynamically (and lazily) expands into the powerset of possible imports.
For the example above:
import {Foo} from '~anyComponent';
would resolve to a module containing:import {Bar} from '~anyComponent';
would resolve to a module containing:import {Foo, Bar} from '~anyComponent';
would resolve to a module containing:The text was updated successfully, but these errors were encountered: