Skip to content

snapshot generation warnings on Windows #28739

@MikeMcC399

Description

@MikeMcC399

Current behavior

Snapshot creation outputs hundreds of warnings when run on Windows, for example

> node_modules/ts-node/dist/index.js:247:38: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning)
    247 │             const transpilerFactory = require(transpilerPath)

Desired behavior

No warnings should be produced when snapshots are created on Windows.

Test code to reproduce

On Windows 11 (24H2)

  • Install Python 3.13 from the Microsoft Store.

  • Install Visual Studio Community version 2022, using the workload "Desktop development with C++" with its default selections (which includes Windows 11 SDK). Select (or use Visual Studio Installer > Modify) to add Optional component Windows 10 SDK (for example 10.0.20348.0).

git clone https://github.com/cypress-io/cypress

Use Node.js 18.15.0 18.17.1 20.18.1 22.15.1

If testing on existing clone then

git switch develop
git clean -xfd

using git Bash shell, execute

yarn

Subsequently snapshot generation can be repeated with

yarn build-v8-snapshot-dev

or

.github/workflows/update_v8_snapshot_cache.yml

Job: update-v8-snapshot-cache (windows-latest)
Step: "Generate prod snapshot iteratively"

Cypress Version

First reported on develop branch at tag 13.6.3
Continues to be reproducible on version 15.0.0

Node version

18.15.0 18.17.1 20.18.1 22.15.1

Yarn version

1.22.22

Operating System

Microsoft Windows 11 (and Windows Server 2022)

Debug Logs

yarn run v1.22.21
$ node --max-old-space-size=8192 tooling/v8-snapshot/scripts/setup-v8-snapshot-in-cypress.js --env=dev
2024-01-17T10:58:01.187Z cypress:snapgen:info Looking for bluebird duplicates ...
2024-01-17T10:58:05.102Z cypress:snapgen:info Found 11 bluebird duplicates, removing them
2024-01-17T10:58:05.243Z cypress:snapgen:info Done removing bluebird duplicates
2024-01-17T10:58:05.243Z cypress:snapgen:info Looking for lodash duplicates ...
2024-01-17T10:58:09.041Z cypress:snapgen:info Found 3 lodash duplicates, removing them
2024-01-17T10:58:09.178Z cypress:snapgen:info Done removing lodash duplicates
2024-01-17T10:58:09.180Z cypress:snapgen:info Creating snapshot metadata { nodeModulesOnly: true }
 > node_modules/ts-node/dist/index.js:247:38: warning: This call to "require" will not be bundled because the argument is not a string literal (surround with a try/catch to silence this warning)
    247 │             const transpilerFactory = require(transpilerPath)
        ╵                                       ~~~~~~~

 > node_modules/ts-node/dist/index.js:192:37: warning: "./transpilers/swc.js" should be marked as external for use with "require.resolve"
    192 │         transpiler = require.resolve('./transpilers/swc.js');~~~~~~~~~~~~~~~~~~~~~~

 > node_modules/ts-node/dist/configuration.js:237:56: warning: Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)
    237 │ ...rn (0, util_1.attemptRequireWithV8CompileCache)(require, compiler);

and so on.

Other

Workflow runs on https://github.com/cypress-io/cypress/actions/workflows/update_v8_snapshot_cache.yml also show this issue. Look in windows-latest job, in the step "Generate prod snapshot iteratively"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions