Я использую таблицу фиксированных данных-2 (0.8.13) вместе с React (15.4.2). Однако, когда я импортирую файл CSS, я получаю сообщение об ошибке
Module parse failed: /Users/Desktop/ReactReduxStore/node_modules/fixed-data-table-2/dist/fixed-data-table.css Unexpected token (23:0) You may need an appropriate loader to handle this file type.
Импортирую следующим образом:
import 'fixed-data-table-2/dist/fixed-data-table.css';
// webpack.config.js module.exports = { entry: './src/main.js', output: { filename: 'bundle.js' }, module: { loaders: [ { loader: 'babel-loader', test: /\.js$/, exclude: /node_modules/ } ] }, devServer: { port: 3000 } };





Вы должны добавить загрузчики css, чтобы импортировать их,
добавить css-loader и style-loader:
npm install --save-dev css-loader style-loader
то в webpack.config.js сделайте следующее:
module.exports = {
...
module: {
rules: [
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
},{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
},
...
}
Обратите внимание, что:
module.loadersin Webpack v1 is nowmodule.rulesin Webpack v2+. The old loader configuration was superseded by a more powerful rules system, which allows configuration of loaders and more. For compatibility reasons, the old module.loaders syntax is still valid and the old names are parsed. The new naming conventions are easier to understand and are a good reason to upgrade the configuration to using module.rules.
Добавьте свой код
webpack.config.js.