我无法对 css-loader 的引导程序问题做出反应
I can't build my react with boostrap problem about css-loader
我的反应 index.js 导入 bootstrap,我使用 Webpack 4
import React from 'react';
import ReactDOM from 'react-dom';
import './assets/css/index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import 'bootstrap/dist/css/bootstrap.min.css';
ReactDOM.render(<App />, document.getElementById('root'));
serviceWorker.unregister();
当我运行构建时,这个错误信息
ERROR in ./node_modules/bootstrap/dist/css/bootstrap.min.css 6:3
Module parse failed: Unexpected token (6:3)
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
module: {
...
{
test: /\.css$/,
exclude: /(node_modules)/,
use: ['style-loader', 'css-loader'],
},
...
}
感谢您的帮助。
您排除了导致此问题的 node_modules,将其从 wabpack 配置中移除。
module: {
...
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
...
}
我的反应 index.js 导入 bootstrap,我使用 Webpack 4
import React from 'react';
import ReactDOM from 'react-dom';
import './assets/css/index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import 'bootstrap/dist/css/bootstrap.min.css';
ReactDOM.render(<App />, document.getElementById('root'));
serviceWorker.unregister();
当我运行构建时,这个错误信息
ERROR in ./node_modules/bootstrap/dist/css/bootstrap.min.css 6:3
Module parse failed: Unexpected token (6:3)
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
module: {
...
{
test: /\.css$/,
exclude: /(node_modules)/,
use: ['style-loader', 'css-loader'],
},
...
}
感谢您的帮助。
您排除了导致此问题的 node_modules,将其从 wabpack 配置中移除。
module: {
...
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
...
}