abeet / Blog

github写博客,博客文章见本项目Issues
23 stars 2 forks source link

基于Vue的WebApp开发工程构建中踩的坑 #25

Open abeet opened 6 years ago

abeet commented 6 years ago

查资料,说要配置webpack的配置项 resolve.alias,说是组件别名,让js里引用路径可以简写

  resolve: {
    extensions: ['.js', '.vue'],
    alias: {
      vue$: 'vue/dist/vue.esm.js' // 'vue/dist/vue.common.js' for webpack 1
    }
  },

这样让vue对象挂上compile方法。

    watch([src.assets], function () {
      runSequence('copyAssets', electron.reload)
    })
  var electronStarted = false
  webpack(webpackConfig).watch(200, function (err, stats) {
      if (err) {
        throw new gutil.PluginError('webpack', err)
      }
      gutil.log('webpack', stats.toString())
      if (!electronStarted) {
        electronStarted = true
        electron.start()
      } else {
        electron.reload()
      }
  })