Hej,
Chciałbym zastosować w Reacths css modułowe.
O ile zwykłe arkusze działają, to modułowe już nie. Terminal nie wyrzuca błędów.
Plik webpack.config.js :
module.exports = {
entry: './src',
output: {
path: 'build',
filename: 'bundle.js',
},
module: {
rules: [
{
test: /\.css$/,
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules: true,
localIdentName: '[name]__[local]__[hash:base64:5]'
}
}
]
}
]
}
};
Index.js:
import React from 'react';
import Header from '../Header';
import styles from '../Header/styles.css';
const App = () => (
<div>
<Header />
<h2 className={styles.test}>Test</h2>
</div>
);
export default App;
Appka utworzona za pomocą
create-react-app my-app
Ktoś się z tym spotkał?
Dzięki.