Closed blaicer15 closed 2 months ago
i'll check it
could you provide me with the contents of the ~/backend-farm/dist/
directory and the contents of the ~/backend-farm/farm.config.ts
file?
Sure... the image of folder dist:
my file farm.config.ts:
import { defineConfig } from '@farmfe/core'; import NestPlugin from './index.plugin.ts';
export default defineConfig({ plugins: [NestPlugin()], });
@blaicer15 Until this issue is resolved you can use @farmfe/core version 1.2.4
, to temporarily avoid this error
@blaicer15 if you want to use the latest version, you can change index.plugin.ts to:
we will optimize templates and farmup later.
import { JsPlugin } from '@farmfe/core';
export default function NestPlugin(): JsPlugin {
return {
name: 'NestPlugin',
config: (config) => {
const mode =
config.compilation.mode ?? process.env.NODE_ENV ?? 'development';
const isDev = mode === 'development';
const compilation = config.compilation ?? {};
const script = compilation.script ?? ({} as any);
return {
compilation: {
script: {
plugins: script.plugins ?? [],
target: script.target ?? 'es2019',
parser: {
tsConfig: {
decorators: script.parser?.tsConfig?.decorators ?? true,
dts: script.parser?.tsConfig?.dts ?? false,
noEarlyErrors: script.parser?.tsConfig?.noEarlyErrors ?? false,
tsx: script.parser?.tsConfig?.tsx ?? false,
},
},
decorators: {
legacyDecorator: script.decorators?.legacyDecorator ?? true,
decoratorMetadata: script.decorators?.decoratorMetadata ?? true,
decoratorVersion:
script.decorators?.decoratorVersion ?? '2021-12',
includes: [],
excludes: ['node_modules/**/*'],
},
},
presetEnv: compilation.presetEnv ?? !isDev,
minify: compilation.minify ?? !isDev,
output: {
format: compilation.output?.format ?? 'esm',
targetEnv: compilation.output?.targetEnv ?? 'node',
entryFilename:
compilation.output?.entryFilename ?? '[entryName].js',
filename: compilation.output?.filename ?? '[name].[hash].mjs',
},
},
};
},
};
}
The nextjs project can run normally in version 1.3.0
Steps to reproduce
arn dev
yarn run v1.22.22 $ farmup -w [ Farmup ] Using config file at ~/backend-farm/farm.config.ts [ Farmup ] [entry: ./src/main.ts] [format: esm] [target: node] [ Farmup ] Build completed in 922ms ⚡️FULL EXTREME! Resources emitted to ./dist. [ Farmup:NestJs ] node:internal/modules/cjs/loader:1147 throw err; ^
Error: Cannot find module '~/backend-farm/dist/NestJs.mjs' at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15) at Module._load (node:internal/modules/cjs/loader:985:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Node.js v20.11.1
[ Farmup ] "NestJs" PID 22352 exit 1
Reproduce link
No response
What is actually happening?
Compilation fails, does not locate NestJs.mjs file
System Info