babel-plugin-try-import
try import module in webpack
what does this plugin do
convert
let react = ;
into
let { let temp; try temp = default; catch error {} return temp;}
so that webpack won't throw error while react
is not exist
convert
let hasReact = ;
into
let { let temp = false; try require; temp = true; catch error {} return temp;}
so that you can check if a module exists