react-native-web
react-native-web copied to clipboard
babel-plugin add custom module map.
I want to add a custom module map babel config. Easy to extend custom components or apis
const getDistLocation = (importName, opts) => {
const format = isCommonJS(opts) ? 'cjs/' : '';
if (importName === 'index') {
return `react-native-web/dist/${format}index`;
} else if (opts.customMap && opts.customMap[importName]){
return opts.customMap[importName];
} else if (importName && moduleMap[importName]) {
return `react-native-web/dist/${format}exports/${importName}`;
}
};
Using babel to add arbitrary modules to the imports is not something I plan to support at this stage. It introduces too much fragility. You can do this in user-land if you must