ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.6k stars 789 forks source link

bug: nodeResolve.customResolveOptions is a deprecated option in a Stencil Configuration file #6058

Open johnc-ftl opened 3 days ago

johnc-ftl commented 3 days ago

Prerequisites

Stencil Version

4.22.3

Current Behavior

Using stencil config like:

export const config: Config = {
  namespace: 'web-components',
  tsconfig: 'tsconfig.lib.json',
  nodeResolve: {
    customResolveOptions: {
      moduleDirectory: [
        '../../dist/node_modules',
        '../../node_modules'
      ]
    }
  },
...

To use a local build output node_modules in addition to normal node_modules.

This works as expected, but I receive the following warning with each build:

[51:23.7]  @stencil/core
[51:24.0]  v4.22.3

[ WARN  ]  Build Warn
           nodeResolve.customResolveOptions is a deprecated option in a Stencil Configuration file. If you need this
           option, please open a new issue in the Stencil repository
           (https://github.com/ionic-team/stencil/issues/new/choose)

Expected Behavior

No warning.

System Info

  npx stencil info

      System: node 22.6.0
    Platform: windows (10.0.22631)
   CPU Model: 12th Gen Intel(R) Core(TM) i9-12900H (20 cpus)
    Compiler: C:\src\ftl\webui\node_modules\@stencil\core\compiler\stencil.js
       Build: 1732216626
     Stencil: 4.22.3
  TypeScript: 5.5.4
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

Create a stencil library with similar config to what I provided above.

Code Reproduction URL

https://github.com/johncrim/stencil

Additional Information

(This isn't a repro URL - I don't think one is required, the issue is straightforward)

christian-bromann commented 2 days ago

@johnc-ftl thanks for raising this issue.

This field is used to configure @rollup/plugin-node-resolve when generating any non-documentation output target artifacts. the contents of this option get propagated by the rollup plugin to resolve, which does the actual resolution of files in stencil's in-memory filesystem. In newer versions of @rollup/plugin-node-resolve, this option has been removed, which no option to override defaults (creating a separation of concerns between the plugin and resolve).

To use a local build output node_modules in addition to normal node_modules.

Can you please elaborate on your use case and provide maybe a minimal example for this?

johnc-ftl commented 1 day ago

Hi @christian-bromann - thank you for the explanation. I appreciate you all having the deprecation warning vs stopping working :)

Our use case is that we have some internal libraries, that we build first, and that our stencil project depends on. Those libraries write their build output to:

./dist/node_modules

whereas all the normal/external NPM dependencies are written to:

./node_modules.

The Stencil project has external and internal dependencies, thus the config above.

Are you aware of another way to configure dependency resolution to resolve from both directories? I'm happy to switch to another approach that works.