Skip to content

Commit dc8f9bc

Browse files
fix(remix-run/vite): loosen route export restrictions (#8420)
Co-authored-by: Mark Dalgleish <[email protected]>
1 parent b9e8eab commit dc8f9bc

File tree

2 files changed

+0
-101
lines changed

2 files changed

+0
-101
lines changed

integration/vite-route-exports-test.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

packages/remix-dev/vite/plugin.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,6 @@ const supportedRemixConfigKeys = [
4646
type SupportedRemixConfigKey = typeof supportedRemixConfigKeys[number];
4747
type SupportedRemixConfig = Pick<RemixUserConfig, SupportedRemixConfigKey>;
4848

49-
const ROUTE_EXPORTS = new Set([
50-
"ErrorBoundary",
51-
"HydrateFallback",
52-
"action",
53-
"clientAction",
54-
"clientLoader",
55-
"default", // component
56-
"handle",
57-
"headers",
58-
"links",
59-
"loader",
60-
"meta",
61-
"shouldRevalidate",
62-
]);
63-
6449
const SERVER_ONLY_EXPORTS = ["loader", "action", "headers"];
6550

6651
// We need to provide different JSDoc comments in some cases due to differences
@@ -1156,23 +1141,6 @@ export const remixVitePlugin: RemixVitePlugin = (options = {}) => {
11561141
let route = getRoute(pluginConfig, id);
11571142
if (!route) return;
11581143

1159-
// check the exports, fail if unknown exists, unless id ends with .mdx
1160-
let nonRemixExports = esModuleLexer(code)[1]
1161-
.map((exp) => exp.n)
1162-
.filter((exp) => !ROUTE_EXPORTS.has(exp));
1163-
if (nonRemixExports.length > 0 && !id.endsWith(".mdx")) {
1164-
let message = [
1165-
`${nonRemixExports.length} invalid route export${
1166-
nonRemixExports.length > 1 ? "s" : ""
1167-
} in \`${route.file}\`:`,
1168-
...nonRemixExports.map((exp) => ` - \`${exp}\``),
1169-
"",
1170-
"See https://remix.run/docs/en/main/future/vite#strict-route-exports",
1171-
"",
1172-
].join("\n");
1173-
throw Error(message);
1174-
}
1175-
11761144
if (pluginConfig.isSpaMode) {
11771145
let serverOnlyExports = esModuleLexer(code)[1]
11781146
.map((exp) => exp.n)

0 commit comments

Comments
 (0)