Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite plugin doesn't work with Deno #285

Closed
2 of 3 tasks
rlidwka opened this issue Aug 16, 2024 · 6 comments
Closed
2 of 3 tasks

Vite plugin doesn't work with Deno #285

rlidwka opened this issue Aug 16, 2024 · 6 comments
Labels

Comments

@rlidwka
Copy link

rlidwka commented Aug 16, 2024

unplugin-typia version

0.6.18

What platform is your computer? Copy the output of npx envinfo --system -npmPackages cleye --binaries

No response

Describe the bug

I'm trying to add unplugin-typia to an existing project.

Simplified config file is this:

import { defineConfig } from "npm:vite";
import react from "npm:@vitejs/plugin-react";
import UnpluginTypia from "jsr:@ryoppippi/unplugin-typia/vite";

export default defineConfig({
  plugins: [
    UnpluginTypia({}),
    react(),
  ],
});

Using deno run -A --node-modules-dir npm:vite build to run it. Unfortunately, package crashes on import.

Reproduction

$ deno eval 'import UnpluginTypia from "jsr:@ryoppippi/unplugin-typia/vite";'
error: Uncaught (in promise) Error: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received https://jsr.io/@ryoppippi/unplugin-typia/0.6.18/src/core/cache.ts
    at createRequire (node:module:819:13)
    at https://jsr.io/@ryoppippi/unplugin-typia/0.6.18/src/core/cache.ts:11:35

Validations

@ryoppippi
Copy link
Owner

We temporarily close this due to the lack of enough information. Please provide a minimal reproduction to reopen the issue. Thanks.

@ryoppippi ryoppippi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
@rlidwka
Copy link
Author

rlidwka commented Aug 16, 2024

deno eval 'import UnpluginTypia from "jsr:@ryoppippi/unplugin-typia/vite";'

that is minimal reproduction, please run it to check for yourself

edit: nevermind, I see what it's doing, investigating...

edit: no, that line is indeed a minimal reproduction

@rlidwka
Copy link
Author

rlidwka commented Aug 16, 2024

createRequire(import.meta.url) does not work when deno pulls package from jsr registry, because import.meta.url is gonna be actual url (https://jsr.io/@ryoppippi/unplugin-typia/0.6.18/src/core/cache.ts)

I'm not sure what the intended use for this call is, perhaps bug report against deno should be opened.

@rlidwka
Copy link
Author

rlidwka commented Aug 16, 2024

denoland/deno#25071

@ryoppippi ryoppippi reopened this Aug 16, 2024
@ryoppippi
Copy link
Owner

Ok, @rlidwka
I think this cache feature only works for node/bun environment because this cache got stored in node_modules.
Also, cache is disable in default.
So, maybe we should move get version extraction feature into cache getting function?

I'll work on it tomorrow moning.
If you have any idea to solve this, feel free to send me a patch!!

Cheers and good night!

@ryoppippi
Copy link
Owner

@rlidwka
I'll close this issue because,

If you want to contribute it, feel free to send us a patch.

@ryoppippi ryoppippi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2024
@ryoppippi ryoppippi added the vite label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants