[BUG] rax-app
- Dominant language
- JavaScript
- Stars
- 8k
- Forks
- 611
- PR merge metrics
- No merged PRs in 30d
Description
### ⌨️
- [ ] 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”
```js @ali/Icon-Comp
import { createElement } from 'rax';
import cssModule from './index.module.css';
import View from 'rax-view';
const Icon = (props) => {
return (
);
};
export default Icon;
```
2: 然后再rax应用里进行使用:
import Icon from '@ali/Icon-Comp'
页面的build.json见下方:
### Current and expected behavior
本来应给是个cssmodule的类名,结果打包出来不对。
然而,如果组件写在项目里,是可以的。 但是抽出来,搞成npm包,再引入,就不行

### 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_
Contributor guide
Research direction
Start by reproducing the issue with the supplied build.json, the rax-app environment, and the minimal external @ali/Icon-Comp package example. Compare the generated CSS module class names when the component is imported from npm versus defined in the project; done means the external component receives the expected CSS module classes for the web and weex-v2 targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, webpack
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100