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

module: resolve self-references #29327

Closed
wants to merge 1 commit into from
Closed

Commits on Oct 24, 2019

  1. module: resolve self-references

    Adds the ability to `import` or `require` a package from within its
    own source code. This allows tests and examples to be written using
    the package name, making them easier to reuse by consumers of the
    package.
    
    Assuming the `name` field in `package.json` is set to `my-pkg`, its
    test could use `require('my-pkg')` or `import 'my-pkg'` even if
    there's no `node_modules/my-pkg` while testing the package itself.
    
    An important difference between this and relative specifiers like
    `require('../')` is that self-references use the public interface
    of the package as defined in the `exports` field while relative
    specifiers don't.
    
    This behavior is guarded by a new experimental flag
    (`--experimental-resolve-self`).
    jkrems committed Oct 24, 2019
    Configuration menu
    Copy the full SHA
    09dad11 View commit details
    Browse the repository at this point in the history