0

I have built react app without create-react-app, but i cannot debug it. When i try i see minification version of my js code.

webpack.config.js

const path = require('path');
const HtmlWebpackPlagin = require('html-webpack-plugin');


module.exports = {
    entry: ['babel-polyfill', './src/index.js'],
    mode:'development',
    output: {
        path: path.resolve(__dirname, 'build'),
        filename: 'index_bundle.js'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader'
                }
            },
            {
                test: /\.css$/i,
                use: ['style-loader', 'css-loader'],
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlagin({ template: './src/index.html' })
    ]
}

.babelrc

{
    "presets": ["@babel/preset-env", "@babel/preset-react"]
}```
  • 2
    See the `devtool` option in the `webpack.config` docs. – Blue Aug 20 '19 at 15:48
  • You can also install [React Developer Tools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi) If you use redux I suggest using this plugin [redux-devtools-extension](https://github.com/zalmoxisus/redux-devtools-extension) – Grzegorz T. Aug 20 '19 at 15:55
  • Possible duplicate of [How do I generate sourcemaps when using babel and webpack?](https://stackoverflow.com/questions/30870830/how-do-i-generate-sourcemaps-when-using-babel-and-webpack) – Agney Aug 20 '19 at 16:13

0 Answers0