baidu / baidu/san

style 绑定在webpack打包后会被移除

Open
#792 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.7k
Forks
537
PR merge metrics
No merged PRs in 30d

Description

`



选择颜色看看



import san from 'san';

export default san.defineComponent({
initData() {
return {
color: '#000'
};
},
computed: {
mainStyle: function () {
const style = {} as any;
const color = this.data.get('color');
style.color = color;
return style;
}
}
});

.app {
width: 100%;
height: 100%;
overflow: hidden;

.content {
width: 100%;
height: 100%;
overflow: hidden;
}
}
`

如上代码,开发环境没问题,但是 webpack5 打包后,div style 中的样式丢失了,@erik168 能不能帮忙看看呀?谢谢!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided San template and TypeScript component, then compare the development result with a webpack 5 production build. Trace the style binding for the computed mainStyle value; done means the color style remains on the div after bundling.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.