Skip to content

Commit a704db2

Browse files
committed
fix: slice machine configuration not loading in production (cjs), fixes: #212
1 parent c2295a8 commit a704db2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

playground/slicemachine.config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"foo": "bar"
3+
}

src/devtools/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { existsSync } from 'node:fs'
2+
import { readFile } from 'node:fs/promises'
23

34
import { extendServerRpc, onDevToolsInitialized, startSubprocess } from '@nuxt/devtools-kit'
45
import type { Resolver } from '@nuxt/kit'
@@ -71,7 +72,7 @@ export const setupDevToolsUI = (nuxt: Nuxt, resolver: Resolver) => {
7172
const configPath = resolve(nuxt.options.rootDir, 'slicemachine.config.json')
7273

7374
if (existsSync(configPath)) {
74-
return await import(configPath)
75+
return JSON.parse(await readFile(configPath, 'utf-8'))
7576
}
7677

7778
return null

0 commit comments

Comments
 (0)