GithubHelp home page GithubHelp logo

Comments (2)

calebeby avatar calebeby commented on June 12, 2024 1

You can use glob-like patterns in export maps. It looks like the documentation says that in their glob syntax * matches subpaths as well so in their example an export map like this:

  "exports": {
    "./features/*.js": "./src/features/*.js"
  },

would allow importing a file like this:

import featureY from 'es-module-package/features/y/y.js';

main is standardized in node, but not for importing of esm files from esm files (that was always nonstandard and only implemented by bundlers).
module, jsnext:main, es2015, and es2017 are all nonstandard, just implemented by some bundlers and tools.

I think we should stick to export maps and add the globs as needed.

from cloudfour.com-patterns.

spaceninja avatar spaceninja commented on June 12, 2024

I dug into this a bit, but I'm putting it back because it requires a bit more discussion (and, frankly, a check-in with @calebeby about the right path forward).

My (admittedly shallow) understanding is that exports is the new standard, aiming to replace main and module, and has the capability of conditional exports. However, it also introduces the new side effect that @tylersticka mentioned.

My gut says the right answer is to remove exports in favor of our main and module lines, unless exports is giving us some advantage or feature that I'm missing.

A quick survey of how some other pattern libraries handle this:

from cloudfour.com-patterns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.