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

Error: Cannot find module '' when a module name ends with an exclamation mark #8

Description

@hashikuchi

Error: Cannot find module ''
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._resolveFilename (C:\Development\Platform_unit_test_research\Components\Platform\Client\node_modules\tsconfig-paths\lib\register.js:33:40)
at C:\Development\Platform_unit_test_research\Components\Platform\Client\node_modules\amd-loader\amd-loader.js:56:31
at C:\Development\Platform_unit_test_research\Components\Platform\Client\node_modules\amd-loader\amd-loader.js:80:24

It looks the line 48 of amd-loder.js splits the file name which ends with "!" into two or more strings including an empty string then causes the error.

e.g. "myModule!" -> ["myModule", ""]

    var req = function(module, relativeId, callback) {
    if (Array.isArray(relativeId)) {
        // async require
        return callback.apply(this, relativeId.map(req))
    }
    var chunks = relativeId.split("!"); // Issue happens here?
    var prefix;
    if (chunks.length >= 2) {
        prefix = chunks[0];
        relativeId = chunks.slice(1).join("!");
    }
    var fileName = Module._resolveFilename(relativeId, module);
    if (Array.isArray(fileName))
        fileName = fileName[0];
    
    if (prefix && prefix.indexOf("text") !== -1) {
        return fs.readFileSync(fileName, "utf8");
    } else
        return require(fileName);
}.bind(this, mod);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions