ryelle / Foxhound

A text-focused blog theme for WordPress (in React)
https://themes.redradar.net/foxhound
350 stars 39 forks source link

Failing to compile build folder #126

Open luczaki114 opened 6 years ago

luczaki114 commented 6 years ago

I am getting an error compiling the script after freshly cloning it down.

Node: 8.9.1 NPM: 5.7.1 PHP: 7.2.2

ERROR in ./js/index.jsx
Module parse failed: Unexpected token (52:3)
You may need an appropriate loader to handle this file type.
|       blogURL = path + 'page/' + FoxhoundSettings.frontPage.blog + '/';
|       const FrontPageComponent = props => (
|           <SinglePage slug={ FoxhoundSettings.frontPage.page } { ...props } />
|       );
|       frontPageRoute = <Route path={ path } component={ FrontPageComponent } />; // eslint-disable-line react/jsx-no-bind

Line 52:3 is the beginning of : <SinglePage slug={ FoxhoundSettings.frontPage.page } { ...props } />

I imagine that babel-loader is responsible for packing this file and yet...

narekmal commented 6 years ago

Try replacing module definition in webpack.config.js with this:

module: {
    // Webpack rules are applied when a resource is matches the test case
    loaders: [
        {
            test: /\.jsx?$/,
            loader: 'babel-loader',
            exclude: /node_modules/,
            query: {
                presets: ['react']
            }
        },
        {
            test: /\.jsx?$/,
            exclude: [ /node_modules/, /Projects/ ],
            enforce: 'pre',
            loader: 'eslint-loader',
            options: {
                configFile: path.join( __dirname, '.eslintrc' ),
                failOnError: true,
                quiet: true,
            },
        },
        {
            test: /\.scss$/,
            use: ExtractTextPlugin.extract( {
                fallback: 'style-loader',
                use: [ 'css-loader', 'sass-loader' ]
            } ),
        }
    ]
},