Webpack配置

2021-08-28  本文已影响0人  A郑家庆

babelrc

.babelrc和babel.config.js区别

Babel是什么

Babel 是一个 JavaScript 编译器,主要用于将 ECMAScript 2015+ 版本的代码转换为向后兼容的 JavaScript 语法,以便能够运行低版本的浏览器中。

Bable作用
Babel 的优点

(1)Babel 构建在插件之上。插件又可以分为:

babelrc 和 babel.config.js区别

webpack.definePlugin用于创建编译时配置的全局常量,以方便进行环境转换,比如NODE_ENV就是通过这个属性配置的

https://www.xxwwp.top/article/Babel%EF%BC%88%E4%B8%80%EF%BC%89%E5%AE%89%E8%A3%85%E3%80%81%E9%85%8D%E7%BD%AE%E5%92%8C%E5%9F%BA%E6%9C%AC%E4%BD%BF%E7%94%A8
https://www.jianshu.com/p/7fd02a587a35
https://www.keisei.top/webpack-behind-the-scene/
https://juejin.cn/post/6844904132294213639

webpack4升级指南:https://juejin.cn/post/6844903795265126413
vue-loader:https://vue-loader.vuejs.org/zh/migrating.html#%E7%8E%B0%E5%9C%A8%E4%BD%A0%E9%9C%80%E8%A6%81%E4%B8%80%E4%B8%AA%E6%8F%92%E4%BB%B6

报错new _validationerror.default(errors schema configuration)
写法有问题https://www.npmjs.com/package/copy-webpack-plugin

const CopyPlugin = require("copy-webpack-plugin");

module.exports = {
  plugins: [
    new CopyPlugin({
      patterns: [
        { from: "source", to: "dest" },
        { from: "other", to: "public" },
      ],
    }),
  ],
};

Webpack升级遇到的问题

上一篇 下一篇

猜你喜欢

热点阅读