Open DanHulton opened 1 year ago
Getting the same error after upgrading aws-amplify
:
FAIL src/components/foobar.test.tsx [ src/components/foobar.test.tsx ]
TypeError: Unknown file extension ".ts" for /home/runner/work/project-name/node_modules/.pnpm/@aws-amplify+data-schema-types@0.7.17_@aws-sdk+types@3.387.0_aws-cdk-lib@2.139.0_constructs@10.3.0__constructs@10.3.0/node_modules/@aws-amplify/data-schema-types/lib-esm/index.d.ts
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'ERR_UNKNOWN_FILE_EXTENSION' }
This is because of an intrinsic dependency @aws-amplify/data-schema-types@0.7.17
. Their package.json
is quite odd:
"main": "./lib-esm/index.d.ts",
We should probably mock the module or something like that, so I wonder if someone has already done something like this before in such cases.
@kachkaev Can you share more context of the error? Though their "main" field is indeed odd, the error itself is probably coming from NodeJS trying to import/require it, so as long as you put them into test.server.deps.inline
(which makes Vite to process the dependency instead), it might work fine.
Also, OP was about the direct vite-node usage, so it might work slightly differently when using it from Vitest. It would be easier for us to help if you can raise an new issue with a proper reproduction.
Describe the bug
I am writing a CLI for a project of mine and I want to be able to include files from that project when running the CLI for certain tasks. However, since I rune vite (for the UI) and vite-node (for the API) for that project, that means I must be able to run vite-node for the CLI as well. I have chosen oclif for the CLI, as it is a fairly popular CLI framework used by major companies to write their CLIs, however it does not run using vite-node. I get the following error when it attempts to read the
commands
folder and load the individual command files:I do not know which package is responsible for the error, so I am opening an issue in each project and am cross-linking them here:
"vite-node incompatible with oclif" at oclif/oclif
Reproduction
A full reproduction can be found at DanHulton/oclif-vite-node-repro.
This is a minimal install of both oclif and vite-node, as well as the bare minimum amount of changes required to integrate the two (which boil down to changing the shebang to use vite-node and converting oclif to use ESM).
System Info
Used Package Manager
npm
Validations