mylabz-xyz/vue-next-rx

vite support

transtone opened this issue · 4 comments

can't work in vite.

 [vite] Internal server error: Failed to resolve entry for package "@nopr3d/vue-next-rx". 
The package may have incorrect main/module/exports specified in its package.json.
node_modules/vite/dist/node/chunks/dep-66eb515d.js:32070:14: error: [vite:dep-scan] Failed to resolve entry for package "@nopr3d/vue-next-rx". The package may have incorrect main/module/exports specified in its package.json.
    32070 │         throw new Error(`Failed to resolve entry for package "${id}". ` +
          ╵               ^
    at resolvePackageEntry (D:\code\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:32070:15)
    at tryNodeResolve (D:\code\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:31907:11)
    at Context.resolveId (D:\code\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:31790:28)
    at Object.resolveId (D:\code\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:43659:55)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async resolve (D:\code\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:43862:26)
    at async D:\code\hnrr\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:43966:34
    at async callback (D:\code\FE\pc-grid\node_modules\esbuild\lib\main.js:724:28)
    at async handleRequest (D:\code\FE\pc-grid\node_modules\esbuild\lib\main.js:595:30)

   node_modules/vite/dist/node/chunks/dep-66eb515d.js:43956:18: note: This error came from the "onResolve" callback registered here
    43956 │             build.onResolve({
          ╵                   ~~~~~~~~~
    at setup (D:\code\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:43956:19)
    at handlePlugins (D:\code\FE\pc-grid\node_modules\esbuild\lib\main.js:686:7)
    at Object.buildOrServe (D:\code\FE\pc-grid\node_modules\esbuild\lib\main.js:903:44)
    at D:\code\FE\pc-grid\node_modules\esbuild\lib\main.js:1444:17
    at new Promise (<anonymous>)
    at Object.build (D:\code\FE\pc-grid\node_modules\esbuild\lib\main.js:1443:14)
    at Object.build (D:\code\FE\pc-grid\node_modules\esbuild\lib\main.js:1334:51)
    at D:\code\FE\pc-grid\node_modules\vite\dist\node\chunks\dep-66eb515d.js:43816:54
    at Array.map (<anonymous>)

   src/main.js:7:18: note: The plugin "vite:dep-scan" was triggered by this import
        7 │ import VueRx from "@nopr3d/vue-next-rx"~~~~~~~~~~~~~~~~~~~~~

It can't import the default package.
In vite, it must use

import VueRx from "@nopr3d/vue-next-rx/dist/vue-next-rx"
app.use(VueRx)

and import rxjs observable with:

import { merge } from 'rxjs/internal/observable/merge'

Hi, you closed the issue so it's done?

Else if you had an repo for example i can take a look

The package.json defined dist/vue-next-rx.esm.js, but vite couldn't find it out at dist folder. That's the problem.

So reopen