Skip to content

Commit

Permalink
fix(vite): remove legacyCssImports option (#8096)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Nov 22, 2023
1 parent 53e2d45 commit 8c42697
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 144 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-forks-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Remove undocumented `legacyCssImports` option from Vite plugin due to issues with `?url` imports of CSS files not being processed correctly in Vite
99 changes: 0 additions & 99 deletions integration/vite-css-legacy-build-test.ts

This file was deleted.

28 changes: 0 additions & 28 deletions packages/remix-dev/vite/legacy-css-imports.ts

This file was deleted.

18 changes: 1 addition & 17 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { createRequestHandler } from "./node/adapter";
import { getStylesForUrl, isCssModulesFile } from "./styles";
import * as VirtualModule from "./vmod";
import { removeExports } from "./remove-exports";
import { transformLegacyCssImports } from "./legacy-css-imports";
import { replaceImportSpecifier } from "./replace-import-specifier";

// We reassign the "vite" variable from a dynamic import of Vite's ESM build
Expand Down Expand Up @@ -69,9 +68,7 @@ type RemixConfigJsdocOverrides = {
};

export type RemixVitePluginOptions = RemixConfigJsdocOverrides &
Omit<SupportedRemixConfig, keyof RemixConfigJsdocOverrides> & {
legacyCssImports?: boolean;
};
Omit<SupportedRemixConfig, keyof RemixConfigJsdocOverrides>;

type ResolvedRemixVitePluginConfig = Pick<
ResolvedRemixConfig,
Expand Down Expand Up @@ -1092,19 +1089,6 @@ export const remixVitePlugin: RemixVitePlugin = (options = {}) => {
return modules;
},
},
...((options.legacyCssImports
? [
{
name: "remix-legacy-css-imports",
enforce: "pre",
transform(code) {
if (code.includes('.css"') || code.includes(".css'")) {
return transformLegacyCssImports(code);
}
},
},
]
: []) satisfies Vite.Plugin[]),
];
};

Expand Down

0 comments on commit 8c42697

Please sign in to comment.