[英]Create-React-App production overwrites css
Running npm run build
outputs a diffrent css compiled website than when running npm start
what's the difference and why does it happen?运行
npm run build
输出一个不同的 css 编译的网站,而不是运行npm start
有什么区别,为什么会发生? The posts i found were about changing webpack.config
but i know that create-react-app work
a bit differently.我发现的帖子是关于更改
webpack.config
但我知道create-react-app work
方式有点不同。 May you shine some light?你可以发光吗?
My app.js
:我的
app.js
:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import {Provider} from 'react-redux';
import {store, persistor} from './Reducers/configStore'
import {PersistGate} from 'redux-persist/integration/react'
import './index.css';
import './App.css';
import "normalize.css";
import 'bootstrap/dist/css/bootstrap.min.css';
import "@blueprintjs/core/lib/css/blueprint.css";
import "@blueprintjs/icons/lib/css/blueprint-icons.css";
import 'react-notifications-component/dist/theme.css';
require('dotenv').config();
const Piazeta = () => {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<App />
</PersistGate>
</Provider>
)
}
ReactDOM.render(<Piazeta />, document.getElementById('root'));
The problem was that in the development build the bootstrap css was overwriting the css written by me and in the production build it was the other way around.问题在于,在开发构建中,引导程序 css 覆盖了我编写的 css,而在生产构建中则相反。 I had a couple of things named the same which made the problems appear.
我有一些名称相同的东西,这使得问题出现了。 Double check your css every time i guess, the order of them differs in prod and build
每次我猜时都要仔细检查你的 css,它们的顺序在产品和构建中有所不同
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.