father icon indicating copy to clipboard operation
father copied to clipboard

js中解构css Modules :export报错:Error: 'x' is not exported by xxx.less, imported by yyy.tsx

Open sdhr27 opened this issue 4 years ago • 2 comments

image theme.less: image RadioButton.tsx: image 配置文件:

import themes from './src/components/style/index';

export default {
  esm: 'rollup',
  cssModules: true,
  extractCSS: true,
  runtimeHelpers: true,
  lessInRollupMode: {
    modifyVars: themes,
    javascriptEnabled: true,
  },
};

sdhr27 avatar Aug 11 '21 02:08 sdhr27

仅发生在解构时,直接引用可以

import globalVars from 'xxxx.less';

const fontSize = globalVars.fontSize;

sdhr27 avatar Aug 12 '21 01:08 sdhr27

image 添加namedExports: true后正常,但是father没有提供配置项供外部配置,能否加个自定义rollup-plugin-postcss配置的配置项? @PeachScript

sdhr27 avatar Aug 16 '21 01:08 sdhr27

father 4 已发布,可尝试升级到最新版:https://github.com/umijs/father/blob/master/docs/guide/migrate.md

旧版本不再维护,感谢支持

PeachScript avatar Aug 31 '22 11:08 PeachScript