You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
}
Reacted by @brody2consult - Chris J. Brody, Jason Miller, Marvin Hagemeister and Utkarsh Dixit
Reacted by @brody2consult - Chris J. Brody, Jason Miller and Marvin Hagemeister
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.
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?
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).
Activity
Andarist commentedon Mar 12, 2018
Is
alias.jsonused by any other tool? webpack supportsaliasFieldswhich is supposed to adhere to browser field specification.There is a high chance that it would already work if you setup
browserfield in your package.json and makemicrobundleto use that field based on this condition.jaredpalmer commentedon Mar 12, 2018
Can you give me an example snippet of package.json / npm script that would do this?
Andarist commentedon Mar 12, 2018
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.jsonanywhere?developit commentedon Mar 28, 2018
I'm thinking maybe we could support an
"aliases"key in the package.json that follows the format @jaredpalmer described.Andarist commentedon Mar 28, 2018
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
aliasesfield in package.json would make that hard, because the proposed format is flat and global for the project (because it's in package.json).developit commentedon Apr 3, 2018
It's too bad
react-nativewon't define a"browser"field pointing toreact-native-webin their package.json :(jviide commentedon Mar 22, 2019
Does #315 ("Add support for --alias") that was released as a part of v0.10.1 address this?
developit commentedon Feb 17, 2020
@jviide yup!