Troubleshooting
Issues you might face when using esbuild-azure-functions and how to solve them
ReferenceError: [__dirname|__filename] is not defined in ES module scope
ReferenceError: [__dirname|__filename] is not defined in ES module scopeError: Dynamic require of "xyz" is not supported
Error: Dynamic require of "xyz" is not supportedTurn off code splitting
import { build } from 'esbuild-azure-functions';
await build({
project: '.',
clean: true,
esbuildOptions: {
splitting: false,
format: 'cjs',
outExtension: {},
},
});
{
"project": ".",
"clean": true,
"esbuildOptions": {
"splitting": false,
"format": "cjs",
"outExtension": {}
}
}Create a custom setup
The import order of global imports is wrong
Last updated