前端技术之:使用webpack构建React程序配置方法

package.json中需要引入以下依赖:

开发依赖:
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.4”,

运行时依赖:
"react": "^16.6.0",
"react-dom": "^16.6.0"

webpack.config.js中需要增加以下模块解析处理规则:
{

test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
    loader: 'babel-loader',
    options: {
        presets: ['@babel/preset-env']
    }

}

更详细的安装与配置方法请参考以下链接:
https://github.com/babel/babe...
https://babeljs.io/docs/en/ne...

https://www.npmjs.com/package...
https://www.npmjs.com/package...

你可能感兴趣的:(react.js,webpack,node.js,javascript)