-
[react] How to configure css css-loader in webpack?Frontend/react 2020. 1. 10. 16:34
Error:
ERROR in ./node_modules/react-tabs/style/react-tabs.css 1:0 Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders > .react-tabs { | -webkit-tap-highlight-color: transparent; | }
1
npm install --save-dev css-loader
2
// webpack.config.js var path = require('path'); var webpack = require('webpack'); module.exports = { ... module: { rules: [ { test: /\.(js|jsx)$/, exclude: "/node_modules", use: ['babel-loader'], }, { test: /\.html$/, use: [ { loader: "html-loader", options: { minimize: true } } ] }, { test: /\.css$/, use: ['css-loader'] } ] }, };
3
// style.css .title { ... }
4
// App.js import 'style.css';
'Frontend > react' 카테고리의 다른 글