Skip to content

编译没有样式文件(No style files after build) #1797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
StringKe opened this issue Feb 18, 2020 · 4 comments
Closed
1 task done

编译没有样式文件(No style files after build) #1797

StringKe opened this issue Feb 18, 2020 · 4 comments
Labels

Comments

@StringKe
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.4.11

Environment

mac 10.15.3 ,vue 2.6.11,

Reproduction link

https://github.com/vueComponent/ant-design-vue

Steps to reproduce

1.vue cli create typescript vue project
2.vue add ant-design(select full impory and less var)
3.code something

What is expected?

编译后包含样式文件,style files after build

What is actually happening?

没有样式文件编译的css文件极其小
no style files after build
style files after build is small file


整个项目只有antd没有混用。。。莫名就无法编译出css了之前一直是好的。反复百度和查找解决方法但是都没有解决,看到了vue的issues说是webpack的副作用 sideEffects 造成的我试了下,没有解决,在开发下样式是正常加载的,编译后就没有

image

vue.config.js

const isProduction = process.env.NODE_ENV !== 'development';
module.exports = {
  publicPath: isProduction ? '././' : '/',
  // parallel: false,
  productionSourceMap: false,
  css: {
    // extract: false,
    // sourceMap: false,
    // requireModuleExtension: false,
    loaderOptions: {
      less: {
        javascriptEnabled: true,
        globalVars: {
          appClassName: 'designApp',
        },
      },
    },
  },
  pluginOptions: {
    'style-resources-loader': {
      preProcessor: 'less',
      patterns: [],
    },
  },
  chainWebpack: (config) => {
    config.optimization.sideEffects(false);
  },
};
@StringKe
Copy link
Author

import 'ant-design-vue/dist/antd.css'; 此 css 应该是 2w 行
编译后只有 800 行

@StringKe
Copy link
Author

已经找到还原的方式 此项目 https://github.com/StringKe/test 里面可以完美复现,serve下正常工作,build下css文件缺失

@tangjinzhou
Copy link
Member

postcss.config.js 问题,不清楚你那个插件干嘛的 删掉就可以了

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants