You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Resolution of this package as ESM is broken due to missing package.json in esm output #269
NodeJS is resolving this package as CommonJS because a package.json file with "type": "module" is missing from the esm output.
Here is the error I am getting:
SyntaxError: Named export 'LabelFilter' not found. The requested module '@azure/app-configuration-provider' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@azure/app-configuration-provider';
const { LabelFilter, load } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:220:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:321:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
Node.js v22.17.1
If I add a package.json to the dist/esm folder with the contents below, then the error is fixed:
{
"type": "module"
}
I copied this from the @azure/app-configuration package's esm folder.
import pkg from '@azure/app-configuration-provider';
^^^
SyntaxError: The requested module '@azure/app-configuration-provider' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:226:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:335:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
Node.js v22.21.1
This is because we don't have default export in the esm artifact.
I am experiencing the same issue. Locally, if I add "type": "module" to the main package.json` of this package in node_modules, the issue is resolved.
my tsconfig.json file:
ESM default import failed with the following error:
import provider from "@azure/app-configuration-provider";
^^^^^^^^
SyntaxError: The requested module '@azure/app-configuration-provider' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:220:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:321:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
Hey, Martin Najjar (@martinnajjar12) Sorry for the late response. I just merged the PR. I was distracted by other tasks and I forgot this issue. We will release it by the first week in May.
Could you verify that the latest change can solve your problem?
Activity
zhiyuanliang-ms commentedon Jan 30, 2026
Hey, Andrew Jaffie (@ajaffie)
Sorry for the inconvenience.
I was trying to reproduce the issue. But I cannot reproduce the same error message that you got.
Could you please share your code and your setup with me to help me reproduce the issue?
The code below can work on my side.
This is my package.json and tsconfig.json
{ "name": "typescript-playground", "version": "1.0.0", "type": "module", "scripts": { "build": "tsc", "start": "node dist/index.js" }, "devDependencies": { "@types/node": "^25.1.0", "typescript": "^5.6.0" }, "dependencies": { "@azure/app-configuration-provider": "2.3.1" } }{ "compilerOptions": { "target": "ES2019", "module": "nodenext", "moduleResolution": "nodenext", "outDir": "dist", "strict": true, "esModuleInterop": true }, "include": ["src"] }I am using Node.js 22.22.1.
We are use conditional exports (which following Azure SDK's practice)
So the node.js resolution or bundlers should be able to find the correct entry point.
But I do find that if I use default export (like the suggestion from the error message you posted)
I will get the following error:
This is because we don't have default export in the esm artifact.
martinnajjar12 commentedon Feb 20, 2026
I am experiencing the same issue. Locally, if I add
"type": "module" to the mainpackage.json` of this package in node_modules, the issue is resolved.my tsconfig.json file:
{ "extends": "fastify-tsconfig", "compilerOptions": { "outDir": "dist", "rootDir": "src", "sourceMap": true, "declaration": false, "baseUrl": "./", "paths": { "@/*": ["./src/*"] } }, "include": ["src/**/*.ts"], "exclude": ["node_modules"] }my package.json file:
zhiyuanliang-ms commentedon Feb 26, 2026
Hey, Martin Najjar (@martinnajjar12) Andrew Jaffie (@ajaffie)
Sorry for the inconvenience. I am looking into this issue.
Could you please share the code how you import the
@azure/app-configuration-providerpackage to me?ESM named import(above) works fine on my side.
ESM namespace import(above) works fine.
ESM default import failed with the following error:
Both CJS require statements work fine.
If we simply add
"type": "module"to thepackage.jsonof this package. It will break the CJS require usage.I need to add
"main": "./dist/commonjs/index.js"to specify the entry point forrequire().And I also need to override
"type"to"commonjs"in the cjs artifact folder.zhiyuanliang-ms commentedon Feb 26, 2026
Added
"type": "module"to thepackage.jsonin PR #280Andrew Jaffie (@ajaffie) Martin Najjar (@martinnajjar12)Could you verify that this private-built package can work on your side?I cannot upload the build to this comment.
martinnajjar12 commentedon Apr 28, 2026
Hey Zhiyuan Liang (@zhiyuanliang-ms),
We're still blocked by this, will it be solved? I see the PR you raised is not merged yet.
zhiyuanliang-ms commentedon Apr 30, 2026
Hey, Martin Najjar (@martinnajjar12) Sorry for the late response. I just merged the PR. I was distracted by other tasks and I forgot this issue. We will release it by the first week in May.
Could you verify that the latest change can solve your problem?
zhiyuanliang-ms commentedon Apr 30, 2026
linglingye001 We need to have a patch release 2.4.2.
zhiyuanliang-ms commentedon May 7, 2026
Hey, Martin Najjar (@martinnajjar12) Andrew Jaffie (@ajaffie) Byeongji Lim (@qudwl)
2.4.2 has been released
qudwl commentedon May 8, 2026
Hey! Thank you for finishing up this patch. There were no regressions, just we had an esm only build system which did not work well without this fix.