-r esm not working with uvu CLI
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3k
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
Playing around with uvu tonight, I have a command that works with `node`, but doesn't work with the `uvu` CLI:
- Works: `node -r esm -r ../app-scripts-svelte/test/register.js ./src/App.test.js`
- Doesn't work: `yarn run uvu -r esm -r ../app-scripts-svelte/test/register.js src`
- Doesn't work: `../../node_modules/.bin/uvu -r esm -r ../app-scripts-svelte/test/register.js src` (run in a monorepo, if that matters)
Error:
```
... app-template-svelte/src/App.test.js:1
(function (exports, require, module, __filename, __dirname) { import { test } from 'uvu';
^^^^^^
SyntaxError: Cannot use import statement outside a module
```
Can confirm that putting random string in place of `esm` (`-r eawegiawingeawniegain`) causes a different error, so esm seems to be running but having no effect.
This is on the latest version from npm
Based loosly on https://github.com/lukeed/uvu/tree/master/examples/svelte
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the three reported commands, including the monorepo invocation, and inspect the uvu CLI entry point and its handling of Node’s -r options. Done means the CLI loads esm and the register.js hook so the reported App.test.js import runs without the SyntaxError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100