Skip to content

Commit

Permalink
Merge branch 'main' of github.com:rovelstars/reejs
Browse files Browse the repository at this point in the history
  • Loading branch information
renhiyama committed Jan 29, 2024
2 parents f54d65f + 1cda999 commit 704ff32
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 130 deletions.
14 changes: 7 additions & 7 deletions src/cli/cmds/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,16 @@ export default function (prog) {
let pkgName = name.split("/")[0];
let scope = name.replace(pkgName, "");
scope = scope.split("?")[0];
if(pkgName.startsWith("@")){
if (pkgName.startsWith("@")) {
//split scope by "/", and get the first item and append it to pkgName and remove it from scope
pkgName += "/"+scope.split("/")[1];
scope = scope.replace("/"+scope.split("/")[1], "");
pkgName += "/" + scope.split("/")[1];
scope = scope.replace("/" + scope.split("/")[1], "");
}
let url = `https://esm.sh/${pkgName}${
dependencies[pkgName] ? `@${dependencies[pkgName]}` : (
""
//the package may be scoped. if it is scoped, then use the scope too
)
dependencies[pkgName]
? `@${dependencies[pkgName]}`
: ""
//the package may be scoped. if it is scoped, then use the scope too
}${scope}`;
url = new URL(url);
if (isReactPackage) {
Expand Down
Loading

0 comments on commit 704ff32

Please sign in to comment.