Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
chengcyber opened this issue Sep 27, 2020 · 0 comments
Closed

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

chengcyber opened this issue Sep 27, 2020 · 0 comments

Comments

@chengcyber
Copy link
Contributor

chengcyber commented Sep 27, 2020

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant