How to create the production file in react with webpack

0

I have a simple crud that I did in react, the issue is that I did not use the create-react-app tool, but that I did it from scratch with webpack and babel, etc. My problem is how to create the production folder since with webpack it only does it in development. Here is the link to see the files on github in case it works . Thanks

    
asked by lucas 13.09.2018 в 22:13
source

1 answer

1

Basically you have to configure Webpack in my case, leave it to itself.

package.json

"scripts": { "build": "webpack --config webpack.config.prod.js -p", }

webpack.config.prod.js

const path = require('path'); const sourcePath = path.join(__dirname, 'src'); module.exports = { entry: { app: path.resolve(sourcePath, 'index.js'), }, output: { path: path.resolve(__dirname, 'dist'), filename: '[name].[chunkhash].js', publicPath: '/' }, }

    
answered by 19.09.2018 / 04:42
source