[Bug] @microsoft/power-apps 1.1+ dist has extensionless ESM relative imports - unresolvable by Node consumers (vitest and others)
Summary
Since v1.1.x, @microsoft/power-apps ships an ESM-only dist/ ("type": "module") whose relative imports omit file extensions, for example in dist/data/index.js:
import ... from './multiSelectPicklistUtils'
import ... from './powerAppsData'
Bundlers (vite, webpack) resolve these fine, but Node's ESM resolver requires explicit extensions, so any tool that resolves the package with Node semantics fails at import:
Error: Cannot find module '...\node_modules\@microsoft\power-apps\dist\data\multiSelectPicklistUtils'
imported from ...\node_modules\@microsoft\power-apps\dist\data\index.js
The practical impact is unit testing: vitest externalizes node_modules by default and resolves them with Node semantics, so any test that transitively imports the SDK (for example via generated services) fails to collect. Production vite build is unaffected, which makes the failure look like a test-infrastructure problem rather than a packaging one.
Confirmed present in 1.1.x, 1.2.13, and 1.3.0 (GA). v1.0.3 was unaffected because it shipped dual lib/ (ESM) + lib-cjs/ (CJS) with conditional exports, and Node consumers resolved the CJS side.
Repro
npm init -y
npm i @microsoft/power-apps@1.3.0
node -e "import('@microsoft/power-apps/data')" # ERR_MODULE_NOT_FOUND
Workaround
In vitest.config.ts, inline the package so vite's resolver transforms it:
test: {
server: { deps: { inline: [/@microsoft[\\/]power-apps/] } },
}
Suggested fix
Emit extensioned relative imports in dist/ (TypeScript 5 moduleResolution: nodenext output, or a build step), or restore a dual ESM/CJS build with conditional exports.
[Bug] @microsoft/power-apps 1.1+ dist has extensionless ESM relative imports - unresolvable by Node consumers (vitest and others)
Summary
Since v1.1.x,
@microsoft/power-appsships an ESM-onlydist/("type": "module") whose relative imports omit file extensions, for example indist/data/index.js:Bundlers (vite, webpack) resolve these fine, but Node's ESM resolver requires explicit extensions, so any tool that resolves the package with Node semantics fails at import:
The practical impact is unit testing: vitest externalizes node_modules by default and resolves them with Node semantics, so any test that transitively imports the SDK (for example via generated services) fails to collect. Production
vite buildis unaffected, which makes the failure look like a test-infrastructure problem rather than a packaging one.Confirmed present in 1.1.x, 1.2.13, and 1.3.0 (GA). v1.0.3 was unaffected because it shipped dual
lib/(ESM) +lib-cjs/(CJS) with conditional exports, and Node consumers resolved the CJS side.Repro
Workaround
In
vitest.config.ts, inline the package so vite's resolver transforms it:Suggested fix
Emit extensioned relative imports in
dist/(TypeScript 5moduleResolution: nodenextoutput, or a build step), or restore a dual ESM/CJS build with conditional exports.