jgcmarins / babel-register-esm

repo to reproduce a issue with babel-register + esm and module field

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

babel-register + ESM

This repo is to demonstrate how to use ESM to resolve module field instead of main on package.json

related to this issue: standard-things/esm#794

How to test it

node babelx.js ./packages/main/src/index.js

it will throw this error:

 Error: Cannot find module '@test/shared'. Please verify that the package.json has a valid "main" entry
    at Object.<anonymous> (/babel-register-esm/packages/main/src/index.js:3:38)

How to make it work

Go to packages/shared and transpile it

yarn workspace @test/shared build

try to run babelx.js again, it will output:

shared
done

About

repo to reproduce a issue with babel-register + esm and module field


Languages

Language:JavaScript 93.9%Language:TypeScript 6.1%