在使用vuecl3打包時遇到的錯誤,做一下筆記
問題描述:在打包過程出現 沒有可用於依賴類型的模塊 CssDependency
在vue.config.js中添加
module.exports = { css: { extract: false } };
我也查找到了相對應的文檔, 發現有些還是不能理解的, 也不清楚怎么會發生這種, 之前好好的, 突然就不可以打包了
原文如下:
css.extract
Type: boolean | Object
Default: true in production, false in development
Whether to extract CSS in your components into a standalone CSS files (instead of inlined in JavaScript and injected dynamically).
This is always disabled when building as web components (styles are inlined and injected into shadowRoot).
When building as a library, you can also set this to false to avoid your users having to import the CSS themselves.
Extracting CSS is disabled by default in development mode since it is incompatible with CSS hot reloading. However, you can still enforce extraction in all cases by explicitly setting the value to true.
Instead of a true, you can also pass an object of options for the mini-css-extract-plugin if you want to further configure what this plugin does exactly.
鏈接: https://cli.vuejs.org/config/#css-extract
第二種方法就是在編譯的時候更換模式, 在腳手架中進行設置
原博客: https://blog.csdn.net/weixin_45615791/article/details/104294458