0

I am using Webpack to build my react-redux apps and encountered a situation: I tried to take some common components out of one app directory in order to reuse them during multiple react app, but when I tried to load one component outside the app directory I got errors:

Module build failed: SyntaxError: D:/dev/gdas/WebContent/reactx/common/components/HeaderFooter/Header.js: Unexpected token (74:31)

My babel-loader rule in webpack.config.js is as below:

{
    test: /\.jsx?$/,
    include: [path.resolve(__dirname, 'src'), path.resolve(__dirname, '../reactx/common/components')],
    loader: 'babel-loader'
}

and My import code is as below:

import Header from '../../../reactx/common/components/HeaderFooter/Header.js'

Is that any solution to fix this issue?

1 Answers1

0

You're doing everything right. It's just that this file D:/dev/gdas/WebContent/reactx/common/components/HeaderFooter/Header.js has a SyntaxError at 74:31

thangngoc89
  • 1,400
  • 11
  • 14