# 打包方案

# 目标

  1. es2015
  2. 前端自动更新
  3. 解析 .vue 文件
  4. 拆分出 vendor 与

# 安装 webpack2

Yarn add --dev webpack@beta

# 遇到问题

  1. Chunk.entry was removed. Use hasRuntime()
# 安装新版本的插件
yarn add extract-text-webpack-plugin@^2.0.0-beta
  1. Resolve Webpack 2.0 Resolving (opens new window)
  2. this._init is not a function Webpack.config.js
# vue -> vue-loader
rules: [{
      test: /\.vue$/,
      loader: 'vue-loader'
    },
  1. webpackJsonp is not defined
<-- 由于配置了文件分割,需在页面中引用生成的所有文件 -->
<script src="js/manifest.js"></script>
<script src="js/vendor.js"></script>
<script src="js/app.js"></script>

# 参考资料

Last Updated: 5/14/2022, 11:38:45 AM