vue 与 electron https://github.com/SimulatedGREG/electron-vue 安装 打包

vue 与 electron

https://github.com/SimulatedGREG/electron-vue

安装

# vue-cli4.0
vue init simulatedgreg/electron-vue my-project
cd my-project
npm install
npm run dev
// 如果遇到process is not define ,删除index.ejs的
//  <% if (!process.browser) { %>
//  <% }%>

// 或者
// 修改 HtmlWebpackPlugin
// .electron-vue/webpack.web.config.js 和 .electron-vue/webpack.renderer.config.js:
// 为
new HtmlWebpackPlugin({
  filename: "index.html",
  template: path.resolve(__dirname, "../src/index.ejs"),
  templateParameters(compilation, assets, options) {
    return {
      compilation: compilation,
      webpack: compilation.getStats().toJson(),
      webpackConfig: compilation.options,
      htmlWebpackPlugin: {
        files: assets,
        options: options
      },
      process
    };
  },
  minify: {
    collapseWhitespace: true,
    removeAttributeQuotes: true,
    removeComments: true
  },
  nodeModules: false
});

打包

# 记着设上代理
# npm config set proxy http://127.0.0.1:1080
# npm confit set https-proxy http://127.0.0.1:1080
# 对应的取消代理
# npm config delete proxy
# npm config delete https-proxy
npm run build

暂无评论