node.js – i am getting below error while i am implementing the webpack in react js
ERROR in ./src/index.js 9:2
Module parse failed: Unexpected token (9:2)
File was processed with these loaders:
- ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|
| ReactDOM.render(
<React.StrictMode>
|
| </React.StrictMode>,
index.js
import './index.css';
import App from './App';
import React from 'react';
import ReactDOM from 'react-dom';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
],
},
};
Read more here: Source link
