Subwaytime / vite-aliases

Alias auto generation for Vite
https://www.npmjs.com/package/vite-aliases
MIT License
213 stars 13 forks source link

Solid JS error #46

Closed tsanyqudsi closed 1 year ago

tsanyqudsi commented 2 years ago

The main issue with SolidJS in vite using vite-aliases are :

Generator {
  options: {
    dir: 'src',
    prefix: '@',
    deep: true,
    depth: 1,
    createGlobalAlias: true,
    createLog: false,
    logPath: 'src/logs',
    adjustDuplicates: false,
    useAbsolute: false,
    useConfig: true,
    useIndexes: true,
    useTypescript: true,
    root: '***Omitted***'
  },
  fullPath: '***Omitted***',
  aliases: [],
  directories: Set(0) {},
  paths: {},
  searched: false,
  servermode: 'serve'
}

Your example is working well so I figures it's because of another vite plugins. I haven't check with react but I will later.

I'm using Windows 10 btw, haven't test it on Linux.

Originally posted by @tsanyqudsi in https://github.com/Subwaytime/vite-aliases/issues/43#issuecomment-1283410165

Subwaytime commented 2 years ago

I havent had the time to setup SolidJs but might be able todo it this Weekend and see if i can find the error. I think it might still have something todo with the esm move, so ill investigate!

Subwaytime commented 2 years ago

Hm, so i cant seem to reproduce this! vite-aliases package.json has a exports section that should definitely be picked up.. could you provide a test repo? :thinking: - Otherwise i am not sure if i can find the issue on my system..

tsanyqudsi commented 2 years ago

@Subwaytime

I've set up the repo on https://github.com/tsanyqudsi/vite-aliases-monorepo-test. But most probably it's because of Monorepo setting.

However, you can compare it with the react version ( i've set up in the same monorepo ).

houd1ni commented 2 years ago

node -v v19.1.0 "vite": "^3.2.4", "vite-aliases": "^0.9.7"


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [ViteAliases({
    useTypescript: true
  }), vue()]
})

image

tsanyqudsi commented 2 years ago

@houd1ni https://github.com/Subwaytime/vite-aliases/issues/43#issuecomment-1285106211

The same question was asked and answered there. please do mind to check the issues using the search field.

Subwaytime commented 1 year ago

Working on some fixes atm! This seems to also clear the solidjs issue.. :100:

houd1ni commented 1 year ago

@houd1ni #43 (comment)

The same question was asked and answered there. please do mind to check the issues using the search field.

Is "I can't reproduce" an answer, really ? Or "most probably due to monorepo" is an answer ? I have no monorepo setting. And due to this half-abandoned issue, forced to use other solutions.

tsanyqudsi commented 1 year ago

@houd1ni #43 (comment) The same question was asked and answered there. please do mind to check the issues using the search field.

Is "I can't reproduce" an answer, really ? Or "most probably due to monorepo" is an answer ? I have no monorepo setting. And due to this half-abandoned issue, forced to use other solutions.

If you actually CLICKED the link provided, you should see this kind of view :

Untitled

And that's the answer.

Mind that you displayed a despicable attitude in an open source project towards someone who IS NOT the owner of the project that trying to help.

Also barging in with your own Issue unrelated with the title of the issue and acting entitled.

houd1ni commented 1 year ago

If you actually CLICKED the link provided, you should see this kind of view :

Untitled

And that's the answer.

Mind that you displayed a despicable attitude in an open source project towards someone who IS NOT the owner of the project that trying to help.

Also barging in with your own Issue unrelated with the title of the issue and acting entitled.

Why wouldn't you just close this issue with the provided solution to not to misguide some people ? I was really sure that if there's a similar issue, they must be connected or, even better, merged into one.

tsanyqudsi commented 1 year ago

@houd1ni Because it's a different Issue, If you actually learn github or ACTUALLY able to read. then you should see :

image

Plus if you actually able to differentiate words. then you should see :

image

It's an issue FROM #43 that I CREATED. But since it grows into another issue so I actually split it and it becomes #46.

This is an issue for SolidJS and if you read my comment :

image

I actually wrote "ERR_PACKAGE_PATH_NOT_EXPORTED ( current workaround is to update the package.json )." which IF you checked the post origin which was #43 it should showed that the solution was there.

To add, the repo owner @Subwaytime wrote this :

image

Which explains why the issue is not closed yet.

So... Yes, it's connected. Yes, I'm using Github's feature to split issues.

Only those who can't read complains and felt misguided.

Subwaytime commented 1 year ago

It seems both issues are actually not related, so i am trying to fix all three, including the newly posted one. The ESM change will still persist, just needs a readme and example update

Subwaytime commented 1 year ago

@tsanyqudsi hey there, sorry for the late response! i have just put out v0.10.0 - this seems to have fixed the issue, atleast for me, can you confirm on your end if it works?

Subwaytime commented 1 year ago

@houd1ni your issue should be fixed now with latest version v0.10.0!

houd1ni commented 1 year ago

@houd1ni #43 (comment)

The same question was asked and answered there. please do mind to check the issues using the search field.

Hi! Tried it to ensure that issue is fixed. With the initial setup

ViteAliases({
      useTypescript: true,
      // root: './project-front'
    })

it generates output below. With root option uncommented, ERROR [vite-aliases] disappears, but next lines are the same. deep: true doesn't have any impact on this. resolve vite option and other plugins that might affect this, I have disabled also. Command to launch vite is vite ./project --host, that is the project.json is in H:/p/project-front/ and the vite.config.mts is in H:/p/project-front/project/.

  ERROR  [vite-aliases] - No Directories could be found!                                                                                    10:28:36  

  at getDirectories (/H:/p/project-front/node_modules/vite-aliases/dist/index.js:132:18)
  at async Generator.init (/H:/p/project-front/node_modules/vite-aliases/dist/index.js:238:5)

  VITE v4.0.4  ready in 617 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: http://192.168.0.100:5173/
  ➜  press h to show help
X [ERROR] [plugin vite:dep-scan] Cannot read properties of undefined (reading 'length')

    node_modules/esbuild/lib/main.js:1357:21:
      1357 │         let result = await callback({
           ╵                      ^

    at matches$1 (file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:152:35)
    at file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:215:58
    at Array.find (<anonymous>)
    at Context.resolveId (file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:215:42)
    at Object.resolveId (file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:41433:46)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async resolve (file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:41661:26)
    at async file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:41718:34
    at async requestCallbacks.on-resolve (H:\p\project-front\node_modules\esbuild\lib\main.js:1357:22)
    at async handleRequest (H:\p\project-front\node_modules\esbuild\lib\main.js:723:13)

  This error came from the "onResolve" callback registered here:

    node_modules/esbuild/lib/main.js:1281:20:
      1281 │       let promise = setup({

at setup (file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:41717:19)
at handlePlugins (H:\p\project-front\node_modules\esbuild\lib\main.js:1281:21)
at buildOrServeImpl (H:\p\project-front\node_modules\esbuild\lib\main.js:970:5)
at Object.buildOrServe (H:\p\project-front\node_modules\esbuild\lib\main.js:776:5)
at H:\p\project-front\node_modules\esbuild\lib\main.js:2117:17
at new Promise (<anonymous>)
at Object.build (H:\p\project-front\node_modules\esbuild\lib\main.js:2116:14)
at build (H:\p\project-front\node_modules\esbuild\lib\main.js:1963:51)
at scanImports (file:///H:/p/project-front/node_modules/vite/dist/node/chunks/dep-5e7f419b.js:41606:11)
ChenChenyaqi commented 1 year ago

import { ViteAliases } from "./node_modules/vite-aliases"

Subwaytime commented 1 year ago

@houd1ni - have you tried setting the directory?

ViteAliases({
    dir: './project-front'
});

Root can mostly stay as process.cwd() - Its rare that this needs to change.

Subwaytime commented 1 year ago

Any more Information on these Bugs would be great, as i cannot replicate them. Due to the Issues being stale, i have now closed them till there is more Information for me available that i can work with.