#5539 (confusion about `.js`/`.ts`) is happening again
See original GitHub issueDescribe the bug
on "vite": "^3.2.3"
, trying to work with: "@libp2p/kad-dht": "^6.0.1"
the latter contains the line in routing-table/index.ts
:
import * as utils from '../utils.js'
which leads vite to die with the error message:
15:06:54 [vite] Internal server error: Failed to resolve import "../utils.js" from "node_modules/@libp2p/kad-dht/src/routing-table/index.ts?v=d74ebf31". Does the file exist?
Plugin: vite:import-analysis
File: /home/kyra/dev/abyssnet/abyssnet/node_modules/@libp2p/kad-dht/src/routing-table/index.ts?v=d74ebf31:3:23
1 | import KBuck from "k-bucket";
2 | import * as utils from "../utils.js";
| ^
3 | import Queue from "p-queue";
4 | import { TimeoutController } from "timeout-abort-controller";
at formatError (file:///home/kyra/dev/abyssnet/abyssnet/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:39975:46)
at TransformContext.error (file:///home/kyra/dev/abyssnet/abyssnet/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:39971:19)
at normalizeUrl (file:///home/kyra/dev/abyssnet/abyssnet/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:36839:33)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async TransformContext.transform (file:///home/kyra/dev/abyssnet/abyssnet/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:36972:47)
at async Object.transform (file:///home/kyra/dev/abyssnet/abyssnet/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:40228:30)
at async loadAndTransform (file:///home/kyra/dev/abyssnet/abyssnet/node_modules/vite/dist/node/chunks/dep-67e7f8ab.js:36615:29)
the file it’s looking for exists in ../utils.ts
because typescript loooooves “potential future paths” apparently
and yes, i am aware this is a dupe of #5539, as the title suggests, but that one is “fixed” since 2.x and locked.
Reproduction
https://stackblitz.com/edit/vitejs-vite-n3653t?file=main.js
Steps to reproduce
the reproduction link already does most of this, but apparently it didn’t quite save anything. make sure to:
- devdepend on
vite
- depend on
kad-dht
import { kadDHT } from '@libp2p/kad-dht'
in any js file- run the vite live server (or build, for that matter)
- “profit”
System Info
System:
OS: Linux 5.19 Void
CPU: (12) x64 AMD Ryzen 5 2600 Six-Core Processor
Memory: 3.16 GB / 31.30 GB
Container: Yes
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.15.1 - /bin/node
Yarn: 1.22.18 - /bin/yarn
npm: 8.11.0 - /bin/npm
npmPackages:
@vitejs/plugin-vue: ^3.2.0 => 3.2.0
vite: ^3.2.3 => 3.2.4
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- 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.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 10 months ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
gatsby-cli@next: Error: Cannot find module 'babel-code-frame ...
Using gatsby-cli@next , the package @babel/code-frame is referred to in the package.json using the new npm scoped package notation (with @ ), but...
Read more >Teradata/covalent - Gitter
Yep, whenever any of those happen, you git the serve ... @ghost~5539edbc15522ed4b3df7357 ... its between san diego CA, santa clara CA and austin...
Read more >Albuquerque Morning Journal, 02-24-1907 - UNM Digital Repository
Every- thing thai ever happened between them seems lo be known to the pros- - ecutor. win n the trial is resumed Monday,....
Read more >Page 8 — Indianapolis Recorder 11 June 1949 — Hoosier State ...
After the altercation, believing her husband, who was undressed and in bed, was going to reach for the gun. Mrs. Selectman said, she...
Read more >Reliable pattern recognition system with novel semi-supervised ...
This similarity may account for the confusion of numerals and the lower performances when compared with handwritten numeral recognition in general [4].
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Maybe? I’ll close this issue for now but feel free to create a new issue if you achieved to create a repro.
i’m sorry, you’re right there, that makes it work for me now too, i did see the error in the example i tried to share, but that didn’t save correctly. my actual project worked for ages with only this hack:
but now it somehow seems to be content with out them even though i didn’t change anything related to that in the meantime. maybe somehow my installation got temporarily broken?