Whats the difference when configuring webpack babel-loader vs configuring it within package.json?

后端 未结 1 1440
星月不相逢
星月不相逢 2020-12-18 22:39

Hi please help me understand the differences between setting babel config inside .babelrc vs webpack loader options, vs inserting it in package.json.

For example, Wo

1条回答
  •  囚心锁ツ
    2020-12-18 23:02

    Webpack config :

    config the babel-loader completely in webpack.conf.js (no .babelrc).

    Webpack config + .babelrc :

    Enable the babel-loader in webpack.conf.js, let the options object be empty. Configure the options in a .babelrc. Webpack will use the babel-loader with the options given in .babelrc.

    you can remove the webpack presets options if you have a .babelrc, because babel-loader uses babel, which obviously respects the .babelrc.

    0 讨论(0)
提交回复
热议问题