single-spa / single-spa-vue

a single-spa plugin for vue.js applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How to handle global styles generated?

telmaantunes opened this issue · comments

After building a vue 2 application we usually have a folder like this:

Screenshot 2022-04-21 at 18 33 27

This index.html file is not going to be imported from single-spa, so I've removed the HtmlWebpackPlugin as recommend, which skips the index.html.

Screenshot 2022-04-21 at 18 29 52

However, this index.html file imported the global styles generated from vue.

<script defer="defer" src="/main.82db85a9.js" nomodule>

After removing it, my spa only requires the css files from the views, not the "main.hash.js" file (which contains the styles from global components and such).

How can I fix this? While still using hashed files?

Thanks for the help!!

Until now, the only solution I can think of is disabling the css extraction on vue.config.js, which includes the css directly on the main.js file, but I wanted separate files.

css: {
    sourceMap: process.env.NODE_ENV !== 'production',
    extract: false
},