简体   繁体   English

使用 nuxt 构建配置后,babel-import-plugin 似乎没有减少 ant-design-vue 的大小

[英]babel-import-plugin doesn't seem to reduce ant-design-vue size after use nuxt build config

According to the doc Docs It was recommended to use the modularized antd in order to ensure optimization and reduce the app size.根据 doc Docs建议使用模块化的 antd 以确保优化并减小应用程序大小。 However, I tried using the exact code in my nuxt build config but the app size remains the same before and after build using yarn build但是,我尝试在我的 nuxt 构建配置中使用确切的代码,但应用程序大小在使用yarn build之前和之后保持不变

Below is my nuxt build config and the screenshot to the before and after build下面是我的 nuxt 构建配置和构建前后的屏幕截图

 build: {
    analyze: true, // Remove this mode before deployment
    babel: {
      plugins: [
        [
          "import",
          {
            libraryName: "ant-design-vue",
            libraryDirectory: "es",
            style: "css"
          },
        ]
      ]
    }
  }

Here is the build before and after adding the babel-import-plugin这是添加 babel-import-plugin 之前和之后的构建在此处输入图像描述

i just got this fixed and reduced the size drastically to this by only removing the ant-design plugin from the nuxt config.我只是通过从 nuxt 配置中删除 ant-design 插件来解决这个问题并大幅减小大小。

Initially my plug look something like this最初我的插头看起来像这样

 plugins: [
    "@/plugins/antd-ui",
    { src: "@/plugins/vue-carousel", ssr: false }
    // "@/plugins/axios"
  ],

Then I removed the plugin to have something like this然后我删除了插件以获得类似的东西

 plugins: [
    { src: "@/plugins/vue-carousel", ssr: false }
    // "@/plugins/axios"
  ],

Now i have this minimal size现在我有这个最小的尺寸在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM