alibaba/rax

[BUG] rax-app

huenchao opened this issue · 1 comments

⌨️

  • Would you like to work on a fix?

Where is the bug from?

Rax Core

Minimal code and steps to reproduce the bug

1: 有类似上面这种小组件,,我单独把它发布成npm包,比如叫他“@ali/Icon-Comp”

import { createElement } from 'rax';
import cssModule from './index.module.css';
import View from 'rax-view';

const Icon = (props) => {
  return (
    <View
      style={{ position: 'relative', width: '48rpx', height: '48rpx' }}
    >
      <View className={cssModule.deg45} />
      <View className={cssModule.deg315} />
    </View>
  );
};
export default Icon;

2: 然后再rax应用里进行使用:

import Icon from '@ali/Icon-Comp'

页面的build.json见下方:

Current and expected behavior

本来应给是个cssmodule的类名,结果打包出来不对。

然而,如果组件写在项目里,是可以的。 但是抽出来,搞成npm包,再引入,就不行

image

Environment

"rax-app": "^3.8.7",

build.json

{
"targets": [
"web",
"weex-v2"
],
"web": {
"mpa": true,
"pha": false
},
"weex": {
"mpa": true,
"mode": "dom"
},
"swc": false,
"plugins": [
"@ali/build-plugin-rax-app-def",
"@ali/plugin-rax-weex-v2"
],
"webpack5": true,
"inlineStyle": {
"forceEnableCSS": true
}
}

Possible solution

No response

Additional context

No response

组件层面不建议使用 css module,试下直接用 import 'index.css' 的方式导入 css