Skip to content

[node-resolve] can not strip hash easily #587

@chengcyber

Description

@chengcyber

Expected Behavior

# can be part of path instead hash usage, expecting node-resolve can handle this situation

Actual Behavior

# is split into two parts by the following code:

      // strip hash and query params from import
      const [withoutHash, hash] = importee.split('#');
      const [importPath, params] = withoutHash.split('?');
      const importSuffix = `${params ? `?${params}` : ''}${hash ? `#${hash}` : ''}`;
      importee = importPath

So, require('es5-ext/string/#/contains') converts to es-ext/string/ with hash /contains.

Thus, error occurs:

[!] Error: Could not load /home/runner/BustlingImpracticalMice/node_modules/es5-ext/string/index.js#/contains (imported by node_modules/d/index.js): ENOENT: no such file or directory, open '/home/runner/BustlingImpracticalMice/node_modules/es5-ext/string/index.js#/contains'

Additional Information

package d source code

var isValue         = require("type/value/is")
  , isPlainFunction = require("type/plain-function/is")
  , assign          = require("es5-ext/object/assign")
  , normalizeOpts   = require("es5-ext/object/normalize-options")
  , contains        = require("es5-ext/string/#/contains");

As you can see, es5-ext/string/#/contians is the full path of import instead of hash tag...

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