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?