npm install babel-plugin-react-require --save-dev Addreact-requireinto.babelrc. This plugin should be defined beforetransform-es2015-modules-commonjsplugin because it's using ES2015 modules syntax to importReactinto scope. {"plugins": ["react-require"] } ...
importReactfrom'react';exportdefaultfunctionComponent(){/* this part will be transpiled by babel itself as usual */return( React.createElement('div') ); } Usage Installbabel-plugin-react-require. npm install babel-plugin-react-require--save-dev Addreact-requireinto.babelrc. This plugin should ...
Babel plugin to transpile import() to a require(), for node. Best solution for SSR with react-router - seeden/babel-plugin-dynamic-import-node-sync