Skip to content
This repository was archived by the owner on Jun 5, 2022. It is now read-only.

I get an unexpected token error for css file on npm run build command #70

Open
ConnectedReasoning opened this issue Aug 31, 2018 · 3 comments

Comments

@ConnectedReasoning
Copy link

ERROR in ./node_modules/react-images-upload/index.css
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| .fileUploader {
| width: 100%;
| }
@ ./node_modules/react-images-upload/compiled.js 17:0-22
@ ./src/components/cards/card.js
@ ./src/components/cards/cards.js
@ ./src/app.js
@ ./src/index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: NODE_ENV=production webpack --config ./webpack.config.js --progress --colors
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/manuel/.npm/_logs/2018-08-31T14_16_11_628Z-debug.log

@ConnectedReasoning
Copy link
Author

I'm running webpack. This is my css loader
{
test: /.(css)$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader", options: {
sourceMap: true
}
}],
exclude: /node_modules/,
include: __dirname + '/src'
},

@ivnnv
Copy link
Collaborator

ivnnv commented Sep 3, 2018

You need to correctly configure your webpack's css loader, maybe its not searching for all modules inside /node_modules and only working for the main project's css. But this clearly looks like a webpack configuration issue, not actually related to this component.

@umeshShindepatil
Copy link

  1. install - npm install --save-dev css-loader
  2. Add code in Webpack-production.config.js - { test: /.css$/, loader: "css-loader" },

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants