Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): prevent generate task from crashing #5693

Merged
merged 1 commit into from
Apr 23, 2024
Merged

Commits on Apr 23, 2024

  1. fix(cli): prevent generate task from crashing

    this pr is motivated by a scneario where running `npx stencil generate`
    would result in either an error or an early return:
    ```
    npm run generate
    
    > gen-test-1@0.0.1 generate
    > stencil generate
    
    [49:23.1]  @stencil/core
    [49:23.2]  v4.17.0 ♨️
    ```
    
    note: the reported error was never reproduced locally, only the early
    return.
    
    technically, this was introduced in v4.17.0, when we switched over to
    using esbuild for production builds. however, this has been present in
    any build that is esbuild-based since we migrated the cli submodule to
    esbuild (where we had a mixed rollup-esbuild build during the migration
    for dev builds).
    
    removing this alias eliminates dynamic imports in the CJS output of the
    cli submodule:
    ```
    const {
        prompt: r
      } = await import('../sys/node/prompts.js')
    ```
    which wouldn't run properly, causing the error/early return.
    
    this change does cause an increase in bundle size, as we end up
    importing more of prompts.js than we do. to mitigate this, we direct
    the cli module to the export we actually use (leading to less getting
    bundled in the cli module).
    
    fixes: #5692
    
    STENCIL-1294 cannot identified the prompts.js as a function? ?
    rwaskiewicz committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    d25b0c1 View commit details
    Browse the repository at this point in the history