swc-project / swc-node

Faster ts-node without typecheck
MIT License
1.78k stars 75 forks source link

doc: add `@swc/core` dependency to usage example #782

Closed silverwind closed 3 months ago

silverwind commented 4 months ago

On a fresh repo, running the previous example would result in a Error: Cannot find module '@swc/core' otherwise.

I think it'd also be good to add @swc/core as a peer dependency to @swc-node/register, so that @swc/core will be installed automatically when missing.

CLAassistant commented 4 months ago

CLA assistant check
All committers have signed the CLA.

yeliex commented 4 months ago

@swc/core in peerDependencies works as expected

silverwind commented 3 months ago

I see it: https://github.com/swc-project/swc-node/blob/a1098be19a37077c419e42a60cf81889c5c94704/packages/register/package.json#L51

I guess my npm is not set up to automatically install peer dependencies.

silverwind commented 2 months ago

Found the reason why npm did not install @swc/core: I had legacy-peer-deps=true in my .npmrc. Removing it made it install the peer dep.