【问题标题】:vite-plugin-federation doesn't load the styles of my componentsvite-plugin-federation 不加载我的组件的样式
【发布时间】:2022-11-10 04:44:28
【问题描述】:

当我在我的主机应用程序上加载我的组件时,组件加载时没有 css,我正在使用 Vite + Vue with tailwind,有人知道如何加载这些样式吗?

这是我的 vite.conf.ts:

import federation from "@originjs/vite-plugin-federation";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";


export default defineConfig({
  server: {
    port: 8000,
  },
  build: {
    target: ["chrome101", "edge89", "firefox89", "safari15"],
  },
  plugins: [
    vue(),
    federation({
      name: "myLib",
      filename: "remoteEntry.js",
      // Modules to expose
      exposes: {
        "./Counter": "./src/components/Counter.vue",
        "./Controller": "./src/controller.ts",
      },
      shared: ["vue", "css"],
    }),
  ],
});

【问题讨论】:

    标签: webpack tailwind-css vite federation


    【解决方案1】:

    尝试添加cssCodeSplit:假, 例如:

    ...
    build: { 
         target: 'esnext', 
         minify: false, 
         cssCodeSplit: false
       }
    

    【讨论】:

      猜你喜欢
      • 2022-11-10
      • 2022-10-01
      • 2022-10-19
      • 2022-11-19
      • 1970-01-01
      • 2020-07-07
      • 2022-12-01
      • 1970-01-01
      • 2021-11-12
      相关资源
      最近更新 更多