Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css antd package.json中的副作用未按预期工作_Css_Webpack_Antd_Tree Shaking_Webpack Production - Fatal编程技术网

Css antd package.json中的副作用未按预期工作

Css antd package.json中的副作用未按预期工作,css,webpack,antd,tree-shaking,webpack-production,Css,Webpack,Antd,Tree Shaking,Webpack Production,我们在一个项目文件中使用来自antd/lib的lib/styles/.css文件。在生产版本中,即使antd/package.json将提供位置的文件定义为副作用,也不会提供相同的版本 我们已经尝试设置副作用:对于从Webpack config的module.rules中的CSSLoader节点_模块获取的所有CSS文件,设置为true 进口声明- import 'antd/lib/grid/style/index.css'; antd/package.json中的副作用定义 CSSLoade

我们在一个项目文件中使用来自antd/lib的lib/styles/.css文件。在生产版本中,即使antd/package.json将提供位置的文件定义为副作用,也不会提供相同的版本

我们已经尝试设置副作用:对于从Webpack config的module.rules中的CSSLoader节点_模块获取的所有CSS文件,设置为true

进口声明-

import 'antd/lib/grid/style/index.css';
antd/package.json中的副作用定义

CSSLoader规则定义为我们将所需文件标记为副作用的工作的一部分-

{
  include: [/node_modules/],
  sideEffects: true,
}
从antd导入的CSS文件不存在于生产包中

注意:未显示任何错误消息

{
  include: [/node_modules/],
  sideEffects: true,
}