Answer the question
In order to leave comments, you need to log in
How to include styles so that webpack would see them during the build?
Hello.
I am writing an application here in react and trying to set up webpack for work.
However, there is a problem, I wrote styles in style.css and kept them next to index.html, and connected through a line in index.html
, I configured webpack to collect styles in a separate bundle.css, but after assembly there is no content of my style .css, however there are styles from plugins.
Actually, the question is, how can I connect styles to the application, so that webpack would take them into account and add them to the bundle? <link rel="stylesheet" href="./style.css">
Answer the question
In order to leave comments, you need to log in
1) In index.js, import styles, import "style.css";
2) Add your style.css as entry in config
entry: [
'./src/ts/index.tsx',
'./src/assets/styles/style.styl'
],
new MiniCssExtractPlugin({
filename: './assets/css/bundle.css',
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question