vite
vite copied to clipboard
[vite-plugin-svelte-kit] Package subpath './helpers/esm/asyncToGenerator.js' is not defined by "exports"
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
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
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
Closing as I confirmed this is fixed in 4.1.0+.