Comments (3)
存在的问题:比如,在公共(全局)样式含有对 body
的一些重置样式,那么在某个页面中也对 body
进行修改的话会出现无法覆盖公共样式的问题
from react-app.
线索: import
的默认【提升】问题和 css-modules
的导入方式。
from react-app.
解决方案:
第一步,将公共样式从 scss
更改为 css
第二步,将该样式文件导入一个 js
中
第三步,在 webpack
配置的入口顶部优先引入该 js
文件(注意加载顺序)
如下:
entry: {
bundle: ['@babel/polyfill', './src/styles/index.js', './src/script/app.js'],
},
from react-app.
Related Issues (10)
- 【已解决】执行 npm run dev 不能单独生成依赖库,导致 bundle 文件依然较大 HOT 2
- 【已解决】增加 prod 、dev 环境及抽离出 base 公共配置 HOT 3
- 【已解决】图片引用的相对路径失效及 WDS 热更新 Maximum call stack size exceeded HOT 3
- 增加 eslint 代码检测机制
- 【已解决】postcss 和 css-modules 不能同时生效 HOT 2
- 【已解决】'NODE_ENV' 不是内部或外部命令,也不是可运行的程序 HOT 1
- 【已解决】可能导致 eslint rules 失效的原因 HOT 2
- 记录一个问题,安装 node-sass 依赖可能会引发超时或安装失败等错误问题
- 【已解决】如何更优雅的使用 css-modules HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-app.