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

feature request: support URL objects #70

Open
sosukesuzuki opened this issue Dec 9, 2023 · 1 comment
Open

feature request: support URL objects #70

sosukesuzuki opened this issue Dec 9, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@sosukesuzuki
Copy link

Modern Node.js APIs have first support for Web Standard URL objects, so it would be useful to have this interface in this plugin as well.

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { viteStaticCopy } from "vite-plugin-static-copy";

// https://vitejs.dev/config/
export default defineConfig({
  base: "/fml-web/",
  plugins: [
    viteStaticCopy({
      targets: [
        {
          src: new URL("lib/foo.wasm", import.meta.url),
          dest: new URL(".", import.meta.url),
        },
      ],
    }),
    react(),
  ],
});
@sapphi-red sapphi-red added the enhancement New feature or request label Dec 12, 2023
@sapphi-red
Copy link
Owner

While I think accepting URL objects is useful, I think there's multiple things that needs to be considered.

  • src receives a glob. It's not a file path.
    • If a URL object is passed, should it be treated as a file path? or a glob?
    • Should it receive URLPattern as well?
  • Rollup doesn't receive URL objects. Few people would recognize that src/dest can receive URL objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants