Skip to content

createEsbuildPlugin is not compatible with esbuild versions after 0.18.13 and the esbuild-ts example can't build #1068

@runenielsen

Description

@runenielsen

Current behavior

Something was changed in esbuild version 0.18.14, that makes it incompatible with cypress-cucumber-preprocessor's createEsbuildPlugin method, which causes the esbuild-ts example build to fail.

Desired behavior

The esbuild-ts example should build succesfully. Preferably by making cypress-cucumber-preprocessor compatible with the newest version of esbuild (which is currently 0.19.0)

Test code to reproduce

The issue can be reproduced like this from the example code in this repository:

% git clone [email protected]:badeball/cypress-cucumber-preprocessor.git
% cd cypress-cucumber-preprocessor/examples/esbuild-ts
% npm install
% npx tsc

cypress.config.ts:16:17 - error TS2322: Type 'import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Plugin' is not assignable to type 'import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/esbuild/lib/main").Plugin'.
  Types of property 'setup' are incompatible.
    Type '(build: import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<...>' is not assignable to type '(build: import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/esbuild/lib/main").PluginBuild) => void | Promise<void>'.
      Types of parameters 'build' and 'build' are incompatible.
        Type 'import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/esbuild/lib/main").PluginBuild' is not assignable to type 'import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").PluginBuild'.
          The types of 'initialOptions.loader' are incompatible between these types.
            Type '{ [ext: string]: import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/esbuild/lib/main").Loader; }' is not assignable to type '{ [ext: string]: import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Loader; }'.
              'string' index signatures are incompatible.
                Type 'import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/esbuild/lib/main").Loader' is not assignable to type 'import("/private/tmp/cypress-cucumber-preprocessor/examples/esbuild-ts/node_modules/@badeball/cypress-cucumber-preprocessor/node_modules/esbuild/lib/main").Loader'.
                  Type '"local-css"' is not assignable to type 'Loader'.

16       plugins: [createEsbuildPlugin(config)],
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in cypress.config.ts:16

Versions

  • Cypress version: 12.17.3
  • Preprocessor version: 18.0.3
  • Node version: v18.17.0

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions