Skip to content

Commit

Permalink
fix: Don't use es module in vite config because of gross esm/cjs reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Sep 13, 2024
1 parent d073b4c commit b74f23f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { parseRegexSingle } from "@foxxmd/regex-buddy-core";
import react from '@vitejs/plugin-react';
import normalizeUrl from "normalize-url";
import { defineConfig } from 'vite';

const QUOTES_UNWRAP_REGEX: RegExp = new RegExp(/^"(.*)"$/);
export const generateBaseURL = (userUrl: string | undefined): URL => {
let cleanUserUrl = userUrl.trim();
const results = parseRegexSingle(QUOTES_UNWRAP_REGEX, cleanUserUrl);
if(results !== undefined && results.groups && results.groups.length > 0) {
cleanUserUrl = results.groups[0];
if(QUOTES_UNWRAP_REGEX.test(cleanUserUrl)) {
const results = cleanUserUrl.match(QUOTES_UNWRAP_REGEX);
cleanUserUrl = results[1];
}
const base = normalizeUrl(cleanUserUrl, {removeSingleSlash: true});
const u = new URL(base);
Expand Down

0 comments on commit b74f23f

Please sign in to comment.