electron 9.0 + @vue/cli 构建项目的坑

1. typescript 版本 "@types/node": "^12.12.6",   不能用最新的

2. electron的配置里面  background.ts  -->>  nodeIntegration: true

3.引入antd of vue    

   less-loader 版本  需要 5.0.0

 按需加载需要    yarn add babel-plugin-import --dev

   bable-config  配置:  plugins: [['import', { libraryName: 'ant-design-vue', libraryDirectory: 'es', style: 'css' }]]   最后的style  官网是写的  true

 加declare: 创建 someModule.d.ts (命名随意)     
declare module 'ant-design-vue/lib/locale-provider/zh_CN' {
    const Ant: any
    export default Ant;
  }

4.  .vue样式引入less文件需要用相对路径   用@/找不到

5.  less文件的js之类的报错   vue.config.js  加

css: {
    loaderOptions: {
      less: {
        javascriptEnabled: true
      }
    }
  },

  

 
posted @ 2020-06-30 14:16  林下书湘  阅读(352)  评论(0编辑  收藏  举报