Skip to content

Commit

Permalink
Revert d298f04 and use require to resolve FK pkg.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaehring committed Aug 31, 2023
1 parent 3f7f2ea commit 5feb16a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/field-kit/bin/field-scripts/develop-module/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readFileSync } from 'node:fs';
import { createRequire } from 'node:module';
import path from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import { createServer } from 'vite';
import createVuePlugin from '@vitejs/plugin-vue';
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
Expand All @@ -11,9 +11,11 @@ import createMockServer from './mock-server.js';
// The current working directory of the downstream application, which will call
// `npm run field-scripts develop`.
const cwd = process.cwd();
// The root path of this, the @farmos.org/field-kit package itself, which may be
// under the node_modules of the cwd.
const root = fileURLToPath(new URL('../../..', import.meta.url));
// The root path of the @farmos.org/field-kit package itself, which may be a
// workspace in the monorepo, or a peer dependency of a field module project,
// under node_modules alongside field-scripts.
const main = createRequire(import.meta.url).resolve('@farmos.org/field-kit');
const root = path.dirname(main);

/**
* Explicitly use strict mode on the file system (already Vite's default), but
Expand Down

0 comments on commit 5feb16a

Please sign in to comment.