Reputation: 73
I am using React Responsive Carousel for my project, but I am getting this error in console
ROR in ./node_modules/react-responsive-carousel/lib/styles/carousel.min.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
.carousel .control-arrow,.carousel.carousel-slider .control-arrow{-webkit-transition:all .25s ease-in;-moz-transition:all .25s ease-in;-ms-transition:all .25s ease-in;-o-transition:all .25s ease-in;transition:all .25s ease-in;opacity:.4;filter:alpha(opacity=40);position:absolute;z-index:2;top:20px;background:none;border:0;font-size:32px;cursor:pointer}.carousel .control-arrow:hover{opacity:1;filter:alpha(opacity=100)}.carousel .control-arrow:before,.carousel.carousel-slider .control-arrow:before{margin:0 5px;display:inline-block;border-top:8px solid transparent;border-botto
My webpack configuration is:
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyPlugin = require('copy-webpack-plugin')
const path = require('path')
const rootPath = path.join(__dirname, '..', '')
module.exports = {
entry: {
main: './src/index.js',
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
publicPath: '/',
},
devServer: {
historyApiFallback: true,
contentBase: path.join(__dirname, 'dist'),
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.join(rootPath, 'index.html'),
}),
new CopyPlugin({
patterns: [
{ from: 'src/assets', to: 'assets' },
],
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
},
},
{
test: /\.html$/,
use: [
{
loader: 'html-loader',
},
],
},
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
},
{
test: /^(?!.*\.spec\.js$).*\.js$/,
exclude: /node_modules/,
use: [
'babel-loader',
{
loader: 'eslint-loader',
options: {
quiet: true,
},
},
],
},
{
test: /\.(woff|woff2)$/,
use: {
loader: 'url-loader',
},
},
{
test: /\.(woff2|woff)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loaders: ['url-loader?limit=10000&minetype=application/font-woff&name=/fonts/[name].[ext]'],
include: /fonts/,
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loaders: ['url-loader?name=/fonts/[name].[ext]'],
include: /fonts/,
},
{
test: /\.(jpe?g|png|gif|svg|ico)$/i,
loaders: [
'file-loader?hash=sha512&digest=hex&name=[name].[ext]',
'image-webpack-loader?bypassOnDebug=false&optimizationLevel=7&interlaced=false',
],
include: /images/,
},
],
},
}
Upvotes: 1
Views: 2034
Reputation: 17504
It looks like your pattern /\.s[ac]ss$/i
doesn't meet css
extension. Try to mark s
as optional like:
test: /\.s?[ac]ss$/i,
Or make it cleaner by splitting css as new one from scss|sass
:
test: /\.(s[ac]ss|css)$/i,
Upvotes: 1