我已经构建了没有create-react-app的react应用,但是我无法调试它。当我尝试时,我看到了我的js代码的精简版。
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"]
}```