Skip to content

Commit 45cb4c8

Browse files
authored
fix: change default output path to node_modules (#152)
close #150 close #147 close #151 close #149
1 parent 5bf9678 commit 45cb4c8

File tree

6 files changed

+4
-15
lines changed

6 files changed

+4
-15
lines changed

package.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,7 @@
1010
"bin": {
1111
"safe-routes": "dist/cli.js"
1212
},
13-
"exports": {
14-
".": {
15-
"import": "./dist/index.js",
16-
"require": "./dist/index.d.ts"
17-
},
18-
"./vite": {
19-
"import": "./dist/vite.js",
20-
"require": "./dist/vite.d.ts"
21-
}
22-
},
13+
"main": "dist/index.js",
2314
"files": [
2415
"dist",
2516
"vite.js",

src/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type RoutesInfo = Record<string, {
1515
params: string[];
1616
}>
1717

18-
export const DEFAULT_OUTPUT_DIR_PATH = './.react-router/types';
18+
export const DEFAULT_OUTPUT_DIR_PATH = './node_modules';
1919
export const TYPE_FILE_NAME = 'safe-routes.d.ts';
2020

2121
async function buildHelpers(config: RequiredReactRouterConfig): Promise<[RoutesInfo, string[]]> {

src/cli.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import path from 'node:path';
33
import { createContext } from './vite-node.js';
44

55
async function run() {
6-
process.env.SAFE_ROUTES_CLI = 'true';
76
const { runner, server } = await createContext();
87
await runner.executeFile(path.resolve(import.meta.dirname, '../dist/empty.js'));
98
await server.close();

src/vite.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ export function safeRoutes(pluginConfig: PluginOptions = {}): Vite.Plugin {
6767
ctx = extractReactRouterPluginContext(config);
6868
},
6969
async configureServer() {
70-
if (process.env.SAFE_ROUTES_CLI) {
71-
await reactRouterPlugin.buildEnd();
72-
}
7370
generateTypeFile();
7471
},
7572
async watchChange(id) {

vite.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/vite';

vite.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./dist/vite');

0 commit comments

Comments
 (0)