Foxhound icon indicating copy to clipboard operation
Foxhound copied to clipboard

Failing to compile build folder

Open luczaki114 opened this issue 6 years ago • 1 comments

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...

luczaki114 avatar Mar 09 '18 04:03 luczaki114

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' ]
			} ),
		}
	]
},

narekmal avatar Mar 12 '18 16:03 narekmal