GithubHelp home page GithubHelp logo

Comments (3)

pdsuwwz avatar pdsuwwz commented on May 13, 2024

存在的问题:比如,在公共(全局)样式含有对 body 的一些重置样式,那么在某个页面中也对 body 进行修改的话会出现无法覆盖公共样式的问题

from react-app.

pdsuwwz avatar pdsuwwz commented on May 13, 2024

线索: import 的默认【提升】问题和 css-modules 的导入方式。

from react-app.

pdsuwwz avatar pdsuwwz commented on May 13, 2024

解决方案:
第一步,将公共样式从 scss 更改为 css
第二步,将该样式文件导入一个 js
第三步,在 webpack 配置的入口顶部优先引入该 js 文件(注意加载顺序)

如下:

entry: {
  bundle: ['@babel/polyfill', './src/styles/index.js', './src/script/app.js'],
},

from react-app.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.