Skip to content

Commit

Permalink
Update resolve.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
yann300 committed Jul 11, 2024
1 parent 4a026fd commit 67c164e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions libs/remix-url-resolver/src/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export class RemixURLResolver {

async handleNpmImport(url: string): Promise<HandlerResponse> {
if (!url) throw new Error('url is empty')
let fetchUrl = url
const isVersionned = semverRegex().exec(url.replace(/@/g, '@ ').replace(/\//g, ' /'))
if (this.getDependencies && !isVersionned) {
try {
Expand Down Expand Up @@ -172,13 +173,10 @@ export class RemixURLResolver {
// package.json
version = deps[pkg]
}
/*
// saving the version in the URL gives unpredictable situations..
if (version) {
const versionSemver = semver.minVersion(version)
url = url.replace(pkg, `${pkg}@${versionSemver.version}`)
fetchUrl = url.replace(pkg, `${pkg}@${versionSemver.version}`)
}
*/
}
}
} catch (e) {
Expand All @@ -192,7 +190,7 @@ export class RemixURLResolver {
// get response from all urls
for (let i = 0; i < npm_urls.length; i++) {
try {
const req = npm_urls[i] + url
const req = npm_urls[i] + fetchUrl
const response: AxiosResponse = await axios.get(req, { transformResponse: []})
content = response.data
break
Expand Down

0 comments on commit 67c164e

Please sign in to comment.