Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] rax-app #2408

Open
1 task
huenchao opened this issue Apr 21, 2023 · 1 comment
Open
1 task

[BUG] rax-app #2408

huenchao opened this issue Apr 21, 2023 · 1 comment
Labels

Comments

@huenchao
Copy link

⌨️

  • 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

@huenchao huenchao added the Bug label Apr 21, 2023
@luhc228
Copy link

luhc228 commented Apr 25, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants