'Webpack: Module parse failed in react-infinite-scroller
I am working on a react JS project using webpack. Since I am using react-infinite-scroller at some point, the build using webpack.
It's start failing to load a file from the module. This is a part of the generated logs
Version: webpack 4.23.1
Time: 159143ms
Built at: 02/28/2022 1:44:53 PM
105 assets
Entrypoint main = runtime~main.95a00d2926e13143bb27.js vendors~main.525460ea197f463eb32a.chunk.js main.7ab70073cd1aeff93839.chunk.js
ERROR in ./node_modules/react-infinite-scroller/src/InfiniteScroll.js 5:19
Module parse failed: Unexpected token (5:19)
You may need an appropriate loader to handle this file type.
|
| export default class InfiniteScroll extends Component {
> static propTypes = {
| children: PropTypes.node.isRequired,
| element: PropTypes.node,
@ ./app/containers/Aside/index.js 95:29-63
@ ./app/containers/DefaultLayout/DefaultLayout.js
@ ./app/containers/App/index.js
@ ./app/app.js
@ multi ./app/app.js
Child HtmlWebpackCompiler:
1 asset
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
Child __offline_serviceworker:
1 asset
Entrypoint __offline_serviceworker = __offline_serviceworker
npm ERR! code ELIF
ECYCLE
npm ERR! errno 2
This is a part of my webpack config
module.exports = options => ({
mode: options.mode,
entry: options.entry,
output: Object.assign(
{
// Compile into js/build.js
path: path.resolve(process.cwd(), 'build'),
publicPath: '/',
},
options.output,
), // Merge with env dependent settings
optimization: options.optimization,
module: {
rules: [
{
test: /\.js$/, // Transform all .js files required somewhere with Babel
exclude: /node_modules/,
use: {
loader: 'babel-loader',
}
},
Is there anyone how has an idea on why it started failing and how to fix it ?
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|