aleclarson / vite-tsconfig-paths

Support for TypeScript's path mapping in Vite
MIT License
1.3k stars 48 forks source link

4.3.0: No "exports" main defined #131

Closed echocrow closed 8 months ago

echocrow commented 8 months ago

Hi! 👋

Somehow v4.3.0 caused a regression in our build setup, causing builds to fail. I can't quite pin-point the error, but upgrading from 4.2.3 to 4.3.0 I'm seeing the following (maybe noteworthy?) error logged:

Error reading "[...]/sanity.cli.ts": No "exports" main defined in /home/projects/vite-tsconfig-paths-4-3-0-repro/node_modules/tsconfck/package.json

Here's a repro on Stackblitz:

Steps in the repro:

# Install `vite-tsconfig-paths@4.3.0`.
npm run up

# Attempt build.
# This will fail with `4.3.0`, ultimately complaining that `Rollup failed to resolve import "$lib/foo"`.
npm run build

# Switch to `vite-tsconfig-paths@4.2.3`.
npm run down

# Attempt build again. This will now succeed as expected.
npm run build

I could not reproduce this on a bare-bones Vue setup. Just using Vue, everything was working as expected. This may be a niche issue with this particular build setup (using sanity). Blind guess, maybe this is somehow related to sanity using a CJS build of Vite, which may have become incompatible with 4.3.0?

echocrow commented 8 months ago

Re-reading the likely related error log, this may be some kind of regression in the tsconfck package? Looks like this was recently bumped from v2 to v3 as a dependency here. Not sure though if that error is directly related, or unrelated to the build itself failing with 4.3.0.

(Apologies if, besides this likely being a niche issue, I've incorrectly attributed this to vite-tsconfig-paths.)

LServo commented 8 months ago

having the same problem, cjs build too

aleclarson commented 8 months ago

Looks like tsconfck removed their CJS entry in v3.

Should be fixed by cb9b582 in vite-tsconfig-paths v4.3.1

echocrow commented 8 months ago

confirmed fixed here, build is working again in v4.3.1.

thanks for the quick turnaround!