stencil
stencil copied to clipboard
bug: results.fileNames undefined during compilation in stencil 2.17.3 in NX
Prerequisites
- [X] I have read the Contributing Guidelines.
- [X] I agree to follow the Code of Conduct.
- [X] I have searched for existing issues that already report this problem, without success.
Stencil Version
2.17.3
Current Behavior
Currently, I we are having problems compiling one library that we recently created with a few components for a future DS that we plan to make, this is currently the CLI out when we run nx run aqua-elements:build

nx run aqua-elements:build
[ WARN ] exit 1
/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:41837
results.fileNames = results.fileNames.filter((f) => {
^
TypeError: Cannot read properties of undefined (reading 'fileNames')
at Object.t.getParsedCommandLineOfConfigFile (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:41837:33)
at pe (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:8913:2294592)
at Object.e.createWatchProgram (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:8913:2287601)
at createTsBuildProgram (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:63449:12)
at /Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:63483:5
at new Promise (<anonymous>)
at createFullBuild (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:63459:10)
at Object.build (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/compiler/stencil.js:64732:23)
at taskBuild (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/cli/index.cjs:1671:40)
at async runTask (/Users/qismbp12/Documents/GitHub/cbhz-nx/node_modules/@stencil/core/cli/index.cjs:2327:13)

It's important to mention that we use NX as monorepo.
Any reasons why we are having this problem? Is anyone also having the same problem?
Expected Behavior
Have a successful compilation process
Steps to Reproduce
1- npm i
2- nx run aqua-elements:build
Code Reproduction URL
N/A
Additional Information
No response
Hey @orl99 👋
The value stored in results
there is determined by a call to a TypeScript compiler API, getParsedCommandLineOfConfigFiles
. That code can be found here. Looking around that source, it appears as it this block might be the offending code that's returning undefined
.
I think this could be related to attempting to resolve a TS configuration file, which may make sense if the file is in a monorepo.
I think that Stencil can handle this a little more gracefully, but in order to continue debugging this further, can you create a minimal reproduction case for us to investigate further?
Thanks for the issue! This issue has been labeled as needs reproduction
. This label is added to issues that need a code reproduction.
Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.
If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.
For a guide on how to create a good reproduction, see our Contributing Guide.
Thanks for this thread, I have the same problem. I just want to link the related issue in the @nxext/stencil repo: https://github.com/nxext/nx-extensions/issues/771
Steps to reproduce:
yarn create nx-workspace
- Name: test-stencil
- Type: app
- nx-cloud: no
yarn add --dev @nxext/stencil
yarn nx generate @nxext/stencil:application sample --no-interactive
yarn nx run sample:build
-> Working build
yarn add --dev @stencil/[email protected]
yarn nx run sample:build
-> Failing Build
Repo: https://github.com/m4s7/failing-sample
only way to fix as of now is to pin stencil/core at 2.17.1 , as 2.17.2 onwards it starts giving this error
Thanks all, y'all are awesome! I've confirmed this is a bug, and relates to how the NX plugin calls Stencil's APIs. I've ID'ed the commit in the Stencil repo that causes this, and am going to have someone take a look at this early next week
The PR that fixes this issue (#3518) is a part of today's v2.17.4 release. As a result, I'm going to close this issue. Should the issue reoccur on v2.17.4+ of Stencil, please open a new ticket, thanks!