问题描述:在打包过程出现 没有可用于依赖类型的模块 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

第二种方法就是在编译的时候更换模式, 在脚手架中进行设置

Logo

前往低代码交流专区

更多推荐