nwb – Css styles not working in a production build

I’m using nwb to create React components. Some of these components require CSS styling. The way I import my CSS is this way.

import './styles/styles.css'; 

This works in the demo app that’s served when I do npm start. The styles do show up.

My next step is to run npm build. This builds a CommonJS build of my app, which is what I’m interested in. It creates a folder called lib which has the built files.

Now, I import my React component into another app and it gives me this error:

.container { ^ ParseError: Unexpected token 

Looks like it’s unable to parse that CSS, or it’s parsing it as a JS file.

If anyone has had any luck doing this, can you please let me know what it is I’m doing wrong? I’m following the standard steps of building React components as described in the nwb documentation here: https://github.com/insin/nwb/blob/master/docs/guides/ReactComponents.md#developing-react-components-and-libraries-with-nwb

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.