0
votes

A have create-react-app application. I want to run production version on my local machine. I have made 'npm run build' and than 'npx webpack' (for addition info i use react-app-rewired in that poject to config proxy for devserver) and have next mistake:

ERROR in ./src/index.js 13:2
Module parse failed: Unexpected token (13:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
| ReactDOM.render(
>   <Provider store={store}>
|     <App />
|   </Provider>,

'serve -s build' do not work in my case:

zsh: command not found: serve

What should i do to run production build on my local? Thanks for help!

2

2 Answers

1
votes

A better way to handle this would not be to install a new global, but use npx to run serve:

npx run serve -s build
-1
votes

Please check if you have serve installed globally on local machine or not. If not, then follow below commands:

npm install -g serve
serve -s build

If this doesn't work then remove the build, close the command prompt and again run the npm run build command and serve it.

Also, there is no preset & babel-loader in the application so install the dependency and add loader in the application.

npm install babel-preset-es2015

Configure the babel-loader

{
    test: /\.jsx?$/,
    loader: 'babel-loader',
    exclude: /node_modules/,
    query: {
        presets: ['es2015']
    }
}