Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve config directory relative to flat output file structure #12187

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: resolve internal files relative to the package.json
  • Loading branch information
jacob-ebey committed Oct 24, 2024
commit 06958a61932f6a40dff822cbecf4737911a277ad
7 changes: 6 additions & 1 deletion packages/react-router-dev/cli/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ export async function generateEntry(
return;
}

let defaultsDirectory = path.resolve(__dirname, "config", "defaults");
let defaultsDirectory = path.resolve(
path.dirname(require.resolve("@react-router/dev/package.json")),
"dist",
"config",
"defaults"
);
let defaultEntryClient = path.resolve(defaultsDirectory, "entry.client.tsx");

let defaultEntryServer = path.resolve(
Expand Down
7 changes: 6 additions & 1 deletion packages/react-router-dev/vite/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,12 @@ export async function resolveEntryFiles({
}) {
let { appDirectory } = reactRouterConfig;

let defaultsDirectory = path.resolve(__dirname, "config", "defaults");
let defaultsDirectory = path.resolve(
path.dirname(require.resolve("@react-router/dev/package.json")),
"dist",
"config",
"defaults"
);

let userEntryClientFile = findEntry(appDirectory, "entry.client");
let userEntryServerFile = findEntry(appDirectory, "entry.server");
Expand Down
7 changes: 6 additions & 1 deletion packages/react-router-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,12 @@ export let getServerBuildDirectory = (ctx: ReactRouterPluginContext) =>
let getClientBuildDirectory = (reactRouterConfig: ResolvedReactRouterConfig) =>
path.join(reactRouterConfig.buildDirectory, "client");

let defaultEntriesDir = path.resolve(__dirname, "config", "defaults");
let defaultEntriesDir = path.resolve(
path.dirname(require.resolve("@react-router/dev/package.json")),
"dist",
"config",
"defaults"
);
let defaultEntries = fse
.readdirSync(defaultEntriesDir)
.map((filename) => path.join(defaultEntriesDir, filename));
Expand Down
6 changes: 0 additions & 6 deletions packages/react-router/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ export default defineConfig([
format: ["cjs"],
outDir: "dist",
dts: true,
external: [
/*.*/
],
banner: {
js: createBanner(pkg.name, pkg.version),
},
Expand All @@ -31,9 +28,6 @@ export default defineConfig([
format: ["esm"],
outDir: "dist",
dts: true,
external: [
/*.*/
],
banner: {
js: createBanner(pkg.name, pkg.version),
},
Expand Down
Loading