diff --git a/backend-api/scripts/config.common.mjs b/backend-api/scripts/config.common.mjs index 25c7cd6..836b1f5 100644 --- a/backend-api/scripts/config.common.mjs +++ b/backend-api/scripts/config.common.mjs @@ -9,7 +9,12 @@ export default { entryPoints: [path.resolve(dirname, '../entrypoints/index.ts')], outdir: path.resolve(dirname, '../'), platform: 'node', - target: 'node20', + target: 'node22', + format: 'esm', + banner: { + // commonjs用ライブラリをESMプロジェクトでbundleする際に生じることのある問題への対策 + js: 'import { createRequire } from "module"; import url from "url"; const require = createRequire(import.meta.url); const __filename = url.fileURLToPath(import.meta.url); const __dirname = url.fileURLToPath(new URL(".", import.meta.url));', + }, bundle: true, plugins: [nodeExternalsPlugin()], logLevel: 'info',