Prerequisites
Stencil Sass Version
3.3.0, 3.3.1
Stencil Version
4.43.5
Current Behavior
Upgrading @stencil/sass from 3.2.x to 3.3.x causes Stencil's build process to crash immediately with:
[ ERROR ] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in
/…/node_modules/@stencil/sass/package.json
at exportsNotFound (node:internal/modules/esm/resolve:313:10)
at packageExportsResolve (node:internal/modules/esm/resolve:603:13)
at resolveExports (node:internal/modules/cjs/loader:650:36)
at Function._findPath (node:internal/modules/cjs/loader:717:31)
…
Expected Behavior
No error and build finishes
Steps to Reproduce
npm install @stencil/sass@3.3.1
npx stencil build
Code Reproduction URL
notyet
Additional Information
AI gave me this analysis, so I am not pretty sure if this is really the root cause. But the error is real :)
Root cause
In 3.3.x, dist/index.js was converted to a pure ESM module (it starts with import { render } from 'sass-embedded'), but the package.json exports field only declares an "import" condition and no "require" condition:
@stencil/sass 3.3.1 package.json (broken):
{
"main": "./dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js" // ← ESM only, no "require"
}
}
}
@stencil/sass 3.2.3 package.json (working):
{
"main": "./dist/index.js"
// no "exports" field → Node.js falls back to "main"
}
Node.js gives exports strict precedence over main when the field is present. Since there is no "require" condition in 3.3.x, any CJS require('@stencil/sass') call throws ERR_PACKAGE_PATH_NOT_EXPORTED.
@stencil/core compiles and loads stencil.config.ts via CJS require(). Because the Stencil config contains import { sass } from "@stencil/sass", this CJS resolution fails at startup.
Prerequisites
Stencil Sass Version
3.3.0, 3.3.1
Stencil Version
4.43.5
Current Behavior
Upgrading @stencil/sass from 3.2.x to 3.3.x causes Stencil's build process to crash immediately with:
[ ERROR ] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in
/…/node_modules/@stencil/sass/package.json
at exportsNotFound (node:internal/modules/esm/resolve:313:10)
at packageExportsResolve (node:internal/modules/esm/resolve:603:13)
at resolveExports (node:internal/modules/cjs/loader:650:36)
at Function._findPath (node:internal/modules/cjs/loader:717:31)
…
Expected Behavior
No error and build finishes
Steps to Reproduce
npm install @stencil/sass@3.3.1
npx stencil build
Code Reproduction URL
notyet
Additional Information
AI gave me this analysis, so I am not pretty sure if this is really the root cause. But the error is real :)
Root cause
In 3.3.x, dist/index.js was converted to a pure ESM module (it starts with import { render } from 'sass-embedded'), but the package.json exports field only declares an "import" condition and no "require" condition:
@stencil/sass 3.3.1 package.json (broken):
{
"main": "./dist/index.js",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js" // ← ESM only, no "require"
}
}
}
@stencil/sass 3.2.3 package.json (working):
{
"main": "./dist/index.js"
// no "exports" field → Node.js falls back to "main"
}
Node.js gives exports strict precedence over main when the field is present. Since there is no "require" condition in 3.3.x, any CJS require('@stencil/sass') call throws ERR_PACKAGE_PATH_NOT_EXPORTED.
@stencil/core compiles and loads stencil.config.ts via CJS require(). Because the Stencil config contains import { sass } from "@stencil/sass", this CJS resolution fails at startup.