Created
December 22, 2024 00:47
-
-
Save ali-master/5d950101780652a7d09968d4c4f45f03 to your computer and use it in GitHub Desktop.
Run Nestjs with Farm bundler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { defineConfig } from "@farmfe/core"; | |
export default defineConfig({ | |
plugins: [ | |
{ | |
name: "NestJS", | |
priority: 0, | |
config(config) { | |
const inputFileEntry = Object.values(config?.compilation?.input || {})[0] ?? "src/main.ts"; | |
const mode = config.compilation.mode ?? process.env.NODE_ENV ?? "development"; | |
const isDev = mode === "development"; | |
return { | |
compilation: { | |
input: { | |
nest: inputFileEntry, | |
}, | |
script: { | |
plugins: [], | |
target: "es2019", | |
parser: { | |
tsConfig: { | |
decorators: true, | |
dts: false, | |
noEarlyErrors: false, | |
tsx: false, | |
}, | |
}, | |
decorators: { | |
legacyDecorator: true, | |
decoratorMetadata: true, | |
decoratorVersion: "2022-03", | |
includes: [inputFileEntry], | |
excludes: ["node_modules/**/*"], | |
}, | |
}, | |
presetEnv: !isDev, | |
minify: !isDev, | |
clearScreen: true, | |
external: ["farmhash"], | |
persistentCache: true, | |
sourcemap: "inline", | |
output: { | |
format: "esm", | |
targetEnv: "node", | |
entryFilename: "[entryName].js", | |
filename: "[name].[hash].mjs", | |
}, | |
}, | |
}; | |
}, | |
}, | |
], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment