Answer the question
In order to leave comments, you need to log in
Why does Babel replace import with require?
I'm new and I want to partially make the functionality on the site on React. At the same time, I want to break the functionality into separate js files, i.e. use modules. In modern JavaScript, this is done using the export / import commands (no additional libraries seem to be required).
Connected react, babel and my script like this:
<script src="/React/react.development.js" crossorigin></script>
<script src="/React/react-dom.development.js" crossorigin></script>
<script src="/React/babel.min.js"></script>
<script src="/app.js" type="text/babel"></script>
import {Top} from './top.js';
class App extends React.Component {
render () {
<Top />
}
}
ReactDOM.render(
<App />,
document.getElementById('root')
);
Answer the question
In order to leave comments, you need to log in
Have you tried searching the toaster for the answer? response <<<
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question