In my application I have utility libraries that are shared between a typescript CLI program and a web app. The interface exposed by the various plugins (e.g. @dprint/markdown) doesn't work play nice with build tools like next.js which want to bundle everything statically. In particular, I have the following code:
and attempting to build this with next.js produces:
Error: ENOENT: no such file or directory, open '/path/to/project/services/app/.next/server/chunks/plugin.wasm'
at Object.openSync (node:fs:581:18)
at readFileSync (node:fs:457:35)
at 50509 (/path/to/project/services/app/.next/server/chunks/707.js:3:163)
at t (/path/to/project/services/app/.next/server/webpack-runtime.js:1:143)
at 19428 (/path/to/project/services/app/.next/server/app/(studio)/[orgName]/[projectName]/studio/page.js:236:5398)
at Function.t (/path/to/project/services/app/.next/server/webpack-runtime.js:1:143)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async collectGenerateParams (/path/to/project/node_modules/.pnpm/next@14.0.4_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:884:17) {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/path/to/project/services/app/.next/server/chunks/plugin.wasm'
}
> Build error occurred
Error: Failed to collect page data for /[orgName]/[projectName]/studio
at /path/to/project/node_modules/.pnpm/next@14.0.4_@babel+core@7.23.6_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/build/utils.js:1220:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
type: 'Error'
}
Collecting page data . ELIFECYCLE Command failed with exit code 1.
In my application I have utility libraries that are shared between a typescript CLI program and a web app. The interface exposed by the various plugins (e.g.
@dprint/markdown
) doesn't work play nice with build tools like next.js which want to bundle everything statically. In particular, I have the following code:and attempting to build this with next.js produces: