-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"@azure/functions-core" can't be resolved by bundlers #201
Comments
{
"scripts": {
"compile": "tsc",
"bundle": "esbuild dist/src/azure/main.js --bundle --platform=node --external:@azure/functions-core --outfile=dist/index.js",
},
"main": "dist/index.js"
} This is what I'm using, hope it's correct. |
Hi @pcj, "@azure/functions-core" is a built-in module that ships directly in Azure, not through npm. I understand this breaks bundlers, but it's an important piece that links your app code to the underlying Azure Functions runtime. It's analogous to how "path" is a built-in module that ships directly in Node.js. In both cases, the Azure Functions runtime and the Node.js runtime are providing functionality unique to their environment through these modules. Most of our customers actually don't need to bundle their app. We highly recommend you run from a package file, which provides the performance benefits of bundling and is a lot easier to configure. If you still need to use a bundler, then yes the recommendation is to list "@azure/functions-core" as an external package so that your bundler will ignore it. |
@ejizba Thank you for a prompt response. Personally I think "running from a package file" is somewhat orthogonal to this issue, because the customer is still responsible for creating the zip file, which in the naive case just zipping up everything including the In my case, that would be difference of having a deployment zip file around Maybe I missed something about kudu or some other thing regarding zip deployments, because from where I am standing there is no built-in performance benefit. I personally do recommend a bundler for this reason. But I'll go ahead and close the issue. Hopefully it helps someone else in the future. |
Also, your comment:
Is very helpful, I didn't find this documented elsewhere. |
You're correct it would not help with deployment performance at all. I was talking about performance of running your app, specifically every time an instance is started which loads your app code. Instances can be recycled often so the startup performance is definitely important. Another option for speeding up deployments is to run
This was a relatively recent thing starting with the new programming model that just GA-ed in September. We knew the core module wouldn't work with bundlers, but you're the first person to bring it up. I expect you won't be the last, so I can re-open this issue to track doc improvements. |
this is a major bug on @azure/functions what makes it not possible to use on monorepo's or any bigger projects. when will this be fixed? |
Hi @edgehero, please create a new issue with detailed repro steps including how you set up your monorepo, what tools you're using, and what errors you're getting: https://github.com/Azure/azure-functions-nodejs-library/issues/new This issue is only open to track documentation updates, specifically to make it more obvious that folks should list |
Moved to #260 |
1 similar comment
Moved to #260 |
@mildronize @edgehero I've moved your comments to a new issue: #260 The correct action here is to list |
When using a bundler such as
esbuild
, bundling@azure/functions
causes this error:There is no published npm module
@azure/functions-core
.I see that there is a path mapping in
tsconfig.json
, perhaps it's a shim for old or MS internal code?In any case, this breaks bundlers and is very annoying. Can we please get this removed from the tsconfig and just use the correct internal import reference?
The text was updated successfully, but these errors were encountered: