Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Fix of the issue that the module which ends with ! cannot be loaded #8 #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion amd-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ global.define = function (id, deps, factory) {
return callback.apply(this, relativeId.map(req))
}

var chunks = relativeId.split("!");
var chunks = relativeId.split("!").filter(chunk => chunk.length > 0);
var prefix;
if (chunks.length >= 2) {
prefix = chunks[0];
Expand Down
3 changes: 3 additions & 0 deletions test/node_modules/h!.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/node_modules/i.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ assert.equal(g.G, "G");
// TODO
// node_modules + package
// async require

console.log("resolve the module name which includes '!'");
var h = require("h!");
assert.equal(h.A, "A");

var i = require("i");
console.log("resolve the module name which ends with '!'");
assert.equal(i.A, "A");