Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ParseError: Unexpected token" - using v3.3.3 + Browserify v16.1.0 #162

Open
basher opened this issue Mar 2, 2018 · 2 comments
Open

"ParseError: Unexpected token" - using v3.3.3 + Browserify v16.1.0 #162

basher opened this issue Mar 2, 2018 · 2 comments

Comments

@basher
Copy link

basher commented Mar 2, 2018

Please see https://github.com/basher/react-no-webpack

This is a simple React UI library POC. I want to use CSS Modules without using Webpack.

The error happens when parsing
https://github.com/basher/react-no-webpack/blob/master/src/lib/components/WidgetCSS/WidgetCSS.css

This is imported inside
https://github.com/basher/react-no-webpack/blob/master/src/lib/components/WidgetCSS/WidgetCSS.js

I'm simply executing build or watch commands from "package.json" - e.g.
browserify ./src/index.js -o ./build/bundle.js -t babelify

@KITSKevinBonett
Copy link

KITSKevinBonett commented Mar 5, 2018

The docs for this plugin clearly state:
Note: The default configuration should work out of the box with the css-loader.

So do I need to still add any other config options in my .babelrc to parse CSS files?


I've done some more investigation...

"npm run lib" ouptuts https://github.com/basher/react-no-webpack/blob/master/lib/components/WidgetCSS/WidgetCSS.js with generated className property. So Babel works OK.

The issue is with "run build" and "run watch" commands which use Browserify + Babelify.

@KITSKevinBonett
Copy link

I have a workaround now - I've replaced babel-plugin-react-css-modules with css-modulesify.

"package.json" setup here - https://github.com/basher/react-no-webpack/blob/master/package.json

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

No branches or pull requests

2 participants