diff --git a/examples/url/main.tsx b/examples/url/main.tsx index 510304b..d332ddb 100644 --- a/examples/url/main.tsx +++ b/examples/url/main.tsx @@ -1,4 +1,4 @@ -import React from 'https://esm.sh/react@18.2.0'; +import React from "https://esm.sh/react@18.2.0"; import { createRoot } from 'https://esm.sh/react-dom@18.2.0/client'; import { App } from './local.tsx'; import './style.css'; diff --git a/src/url-resolve.ts b/src/url-resolve.ts index 09a97fd..354104a 100644 --- a/src/url-resolve.ts +++ b/src/url-resolve.ts @@ -46,7 +46,7 @@ export default function httpsResolve(config: PluginConfig) { enforce: 'pre' as const, transform(code: string) { - if (code.indexOf('from \'http') === -1) { + if (code.indexOf('from \'http') === -1 && code.indexOf('from \"http') === -1) { return; } @@ -55,7 +55,9 @@ export default function httpsResolve(config: PluginConfig) { const replaced = code.replaceAll( HTTP_IMPORT_REGEX, (str) => { - return str.replace('from \'', 'from \'' + URL_NAMESPACE); + return str + .replace('from \'', 'from \'' + URL_NAMESPACE) + .replace('from \"', 'from \"' + URL_NAMESPACE); }, );