vite icon indicating copy to clipboard operation
vite copied to clipboard

[vite-plugin-svelte-kit] Package subpath './helpers/esm/asyncToGenerator.js' is not defined by "exports"

Open NikolayMakhonin opened this issue 1 year ago • 1 comments

Describe the bug

vite 3.0.2 writes imports to bundle incorrectly, but vite2 works fine:

main.js

import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator";
console.log(_asyncToGenerator);

build command:

vite build --ssr main.js

dist/main.mjs

import _asyncToGenerator from "@babel/runtime-corejs3/helpers/esm/asyncToGenerator.js";
console.log(_asyncToGenerator);

there should not be the .js extensions, because the direct paths is restricted by the @babel/runtime-corejs3/package.json

Reproduction

See this repo

System Info

System:                                                 
    OS: Windows 10 10.0.19042                             
    CPU: (8) x64 Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz
    Memory: 6.11 GB / 15.89 GB                            
  Binaries:
    Node: 16.15.1 - E:\Program Files\nodejs\node.EXE      
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD        
    npm: 8.11.0 - E:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1023.0), Chromium (103.0.1264.62)
    Internet Explorer: 11.0.19041.906

Used Package Manager

pnpm

Logs

No response

Validations

NikolayMakhonin avatar Jul 24 '22 05:07 NikolayMakhonin

I think it related with #8420 The error appears since the 3.0.0-alpha.8 version, because the 3.0.0-alpha.7 generates cjs module

NikolayMakhonin avatar Jul 24 '22 07:07 NikolayMakhonin

Closing as I confirmed this is fixed in 4.1.0+.

sapphi-red avatar Mar 25 '23 12:03 sapphi-red