-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(remix-dev/vite): bundle CSS from client entry (#8143)
Co-authored-by: Pedro Cattori <[email protected]>
- Loading branch information
1 parent
2d3e1d8
commit c043a66
Showing
7 changed files
with
237 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@remix-run/dev": patch | ||
--- | ||
|
||
Bundle CSS imported in client entry file in Vite plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// This file is used to avoid CJS deprecation warnings in Vite 5 since | ||
// @remix-run/dev currently compiles to CJS. By using this interface, we only | ||
// ever access the Vite package via a dynamic import which forces the ESM build. | ||
// "importViteAsync" is expected be called up-front in the first async plugin | ||
// hook, which then unlocks "importViteEsmSync" for use anywhere in the plugin | ||
// and its utils. This file won't be needed when this package is ESM only. | ||
|
||
import invariant from "../invariant"; | ||
|
||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports | ||
type Vite = typeof import("vite"); | ||
let vite: Vite | undefined; | ||
|
||
export async function preloadViteEsm(): Promise<void> { | ||
vite = await import("vite"); | ||
} | ||
|
||
export function importViteEsmSync(): Vite { | ||
invariant(vite, "importViteEsmSync() called before preloadViteEsm()"); | ||
return vite; | ||
} |
Oops, something went wrong.