Skip to content

Alias API #105

Closed
Closed

Description

@jaredpalmer

Working on a react-native-web component that I'd love to build with microbundle. Would you be open to a PR allowing an alias.json file that looked like:

{
   'react-native': 'react-native-web'
}

Activity

  1. Andarist commented on Mar 12, 2018

    @Andarist
    Collaborator

    Is alias.json used by any other tool? webpack supports aliasFields which is supposed to adhere to browser field specification.

    There is a high chance that it would already work if you setup browser field in your package.json and make microbundle to use that field based on this condition.

  2. jaredpalmer commented on Mar 12, 2018

    @jaredpalmer
    ContributorAuthor

    Can you give me an example snippet of package.json / npm script that would do this?

  3. Andarist commented on Mar 12, 2018

    @Andarist
    Collaborator

    Ok, it seems that this is not possible from the project level (I thought it is) - this alias field can only be specified in the package that is imported.

    We need to figure out an alias format then, have you seen your proposed alias.json anywhere?

  4. developit commented on Mar 28, 2018

    @developit
    Owner

    I'm thinking maybe we could support an "aliases" key in the package.json that follows the format @jaredpalmer described.

  5. Andarist commented on Mar 28, 2018

    @Andarist
    Collaborator

    Slight problem with that is that we might want to support outputting bundles targeting different platforms - like node, browser, react-native and unfortunately a single/simple aliases field in package.json would make that hard, because the proposed format is flat and global for the project (because it's in package.json).

  6. developit commented on Apr 3, 2018

    @developit
    Owner

    It's too bad react-native won't define a "browser" field pointing to react-native-web in their package.json :(

  7. jviide commented on Mar 22, 2019

    @jviide
    Contributor

    Does #315 ("Add support for --alias") that was released as a part of v0.10.1 address this?

  8. developit commented on Feb 17, 2020

    @developit
    Owner

    @jviide yup!

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