-
I have a very simple Yarn + Vite + Vue 3 root and mife set up as in the Documentation for this plugin, including the mounting and unmounting of css (despite my only css coming from tailwind classes and in component scoped class styling). From my test-mife HomeView.vue, it seems like the flexbox and alignment styling is working as expected, however the bg-black and text-white are not. This is my most straightforward mife so I have shared this however after integrating another one of my projects, I can see a similar issue where some css is not coming through and affecting the built application. In serve mode, everything works as expected! https://github.com/amalvivek/portfolio |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Hello. I'll have a look if you can help me resolve the following error while running
Any ideas? This happens in the test-mife repository. |
Beta Was this translation helpful? Give feedback.
-
Ok, so I'm currently running the two projects, but I don't know what I'm seeing. Please update with screenshots that describe the styling issue. |
Beta Was this translation helpful? Give feedback.
-
Please see the contents returned by this CSS URL (in preview mode): As you can see, it is incorrect. It is not CSS. This is because you must set Vite's In your test-mife project, try this for configuration: import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vitePluginSingleSpa from 'vite-plugin-single-spa';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(), vitePluginSingleSpa({
type: "mife",
serverPort: 3001
})
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
server: {
hmr: false
},
base: 'http://localhost:3001' // <------------ THIS
}) This will screw up your router, so the router code needs modification: const basePath = new URL(import.meta.env.BASE_URL).pathname; // <---------- Get rid of the absolute part of the base URL
console.log('Base path: %s', basePath);
const router = (base: string) => createRouter({
history: createWebHistory(basePath + base), // <------ This could still give you some grief if you don't take care of potentially double-slashing when concatenating Summarizing: I believe the problem you have is the missing base. |
Beta Was this translation helpful? Give feedback.
Please see the contents returned by this CSS URL (in preview mode):
As you can see, it is incorrect. It is not CSS.
This is because you must set Vite's
base
property. Previous versions of this plug-in used to set this, but not anymore. You need to set your expected base path before building.In your test-mife project, try this for configuration: