kpdecker / jsdiff

A javascript text differencing implementation.
BSD 3-Clause "New" or "Revised" License
7.69k stars 491 forks source link

Failed to resolve entry for package "diff". The package may have incorrect main/module/exports #501

Closed ericrange closed 2 months ago

ericrange commented 4 months ago

with the latest vite, there is the following error. is there an official es6 way to import this lib?

3:28:17 PM [vite] Internal server error: Failed to resolve entry for package "diff". The package may have incorrect main/module/exports specified in its package.json.
  Plugin: vite:import-analysis
  File: /home/Repositories/vue/src/workers/audit-delta-worker.js?worker_file&type=module
chardin1 commented 4 months ago

I'm having this same issue in Node as well:

const Diff = require('diff'); Error: Cannot find module 'diff'

Nevermind. I accidentally ran npm install jsdiff instead of npm install diff

ExplodingCabbage commented 3 months ago

@ericrange can you give me some minimal instructions on how to reproduce the error you're seeing? Happy to try to figure out a fix, but my knowledge of JavaScript module systems is limited and I'd never heard of vite prior to reading this issue.

ExplodingCabbage commented 2 months ago

Closing pending instructions on how to repro the error.