create-react-app 【引入ui框架样式,全局样式被处理成模块化样式处理方法】

react

解决方案

  在引入的ui样式文件的对应处理loader中,将modules.mode设置为global 即可

{

test: cssRegex,

exclude: cssModuleRegex,

use: getStyleLoaders({

importLoaders: 1,

sourceMap: isEnvProduction

? shouldUseSourceMap

: isEnvDevelopment,

modules: {

mode: "global",

},

}),

// Don't consider CSS imports dead code even if the

// containing package claims to have no side effects.

// Remove this when webpack adds a warning or an error for this.

// See https://github.com/webpack/webpack/issues/6571

sideEffects: true,

},

以上是 create-react-app 【引入ui框架样式,全局样式被处理成模块化样式处理方法】 的全部内容, 来源链接: utcz.com/z/384433.html

回到顶部