Skip to content

Commit

Permalink
fix: slice machine configuration not loading in production (cjs), fixes
Browse files Browse the repository at this point in the history
…: #212
  • Loading branch information
lihbr committed Apr 9, 2024
1 parent c2295a8 commit a704db2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions playground/slicemachine.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"foo": "bar"
}
3 changes: 2 additions & 1 deletion src/devtools/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { existsSync } from 'node:fs'
import { readFile } from 'node:fs/promises'

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

if (existsSync(configPath)) {
return await import(configPath)
return JSON.parse(await readFile(configPath, 'utf-8'))
}

return null
Expand Down

0 comments on commit a704db2

Please sign in to comment.