Babel file is copied without being transformed

前端 未结 10 2165
礼貌的吻别
礼貌的吻别 2020-11-22 06:09

I have this code:

\"use strict\";

import browserSync from \"browser-sync\";
import httpProxy from \"http-proxy\";

let proxy = httpProxy.createProxyServer({         


        
10条回答
  •  情歌与酒
    2020-11-22 06:59

    In year 2018:

    Install following packages if you haven't yet:

    npm install babel-loader babel-preset-react
    

    webpack.config.js

    {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              presets: ['es2015','react']  // <--- !`react` must be part of presets!
            }
          }
        ],
      }
    

提交回复
热议问题