Skip to content

Rollup URL Plugin will only remap single quoted import statements. #7

@lukekaalim

Description

@lukekaalim

Expected behavior:
Both single quoted import x from 'y'; and double-quoted import x from "y"; imports should be remapped to localhost.

Observed behaviour:
Only single quoted import statements get remapped, double-quoted statements get ignored - often meaning that they reach out to esm.sh servers and download (so its hard to notice that its not actually served locally since the code still runs like normal).

Reproduction case:

// index.ts
import React from "https://esm.sh/react@18.2.0";
import React2 from 'https://esm.sh/react@18.2.0';

console.log(React);
console.log(React2);
// vite.config.mts
import { defineConfig } from 'npm:vite@3.2.4';
import denoResolve from 'https://deno.land/x/vite_plugin_deno_resolve/mod.ts';

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

Here you can see Vite reaching out to both localhost & esm.sh to resolve React & React2.

Screenshot 2023-09-20 at 2 11 21 am

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions