Skip to content

When using ExtractTextPlugin it break the app #66

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

Closed
idangozlan opened this issue May 28, 2017 · 3 comments
Closed

When using ExtractTextPlugin it break the app #66

idangozlan opened this issue May 28, 2017 · 3 comments

Comments

@idangozlan
Copy link

Trace: You are merging non-object // removed by extract-text-webpack-plugin with an object default
[0]     at /Users/idangozlan/myproject/node_modules/react-css-themr/lib/components/themr.js:265:23
[0]     at Array.forEach (native)
[0]     at merge (/Users/idangozlan/myproject/node_modules/react-css-themr/lib/components/themr.js:217:22)
[0]     at /Users/idangozlan/myproject/node_modules/react-css-themr/lib/components/themr.js:193:12
[0]     at Array.reduce (native)
[0]     at themeable (/Users/idangozlan/myproject/node_modules/react-css-themr/lib/components/themr.js:192:17)
[0]     at Themed.getTheme (/Users/idangozlan/myproject/node_modules/react-css-themr/lib/components/themr.js:139:156)
[0]     at Themed.calcTheme (/Users/idangozlan/myproject/node_modules/react-css-themr/lib/components/themr.js:145:36)
[0]     at new Themed (/Users/idangozlan/myproject/node_modules/react-css-themr/lib/components/themr.js:102:30)
[0]     at ReactCompositeComponentWrapper._constructComponentWithoutOwner (/Users/idangozlan/myproject/node_modules/react-dom/lib/ReactCompositeComponent.js:298:16) /
[0]     at /Users/idangozlan/myproject/src/server.js:341:17
[0]     at process._tickCallback (internal/process/next_tick.js:103:7)

Any special instructions to ExtractTextPlugin usage?

@raveclassic
Copy link
Contributor

@idangozlan Could you provide a minimal representation gist/repo?

@javivelasco
Copy link
Owner

Yes please

idangozlan added a commit to idangozlan/react-css-themr that referenced this issue Jun 7, 2017
when the source style is empty / contain only :global rules, `extract-text-webpack-plugin` put string instead of json, which break the merge.
this if prevent this specific case
javivelasco#66
@idangozlan
Copy link
Author

Ok, so I investigate this issue very deeply, debug it and found the issue.

When using react-css-themr and supplying as base stylesheet which is empty / has only :global rules, for ex:

...
import * as styles from './App.scss';
...

@themr('App', styles)
......

and App.scss is empty / only :global rules, extract-text-webpack-plugin put in the webpack assets file "// removed by extract-text-webpack-plugin" instead of just empty json {}.

when react-css-themr is trying to merge the themed App.scss and the base one, which after the extraction is string of "// removed by extract-text-webpack-plugin", it's screaming, since it can't merge it.

Finally, we can warn users to not include empty/global rules as base theme file, but I would like to prevent users fail with that tricky thing.

Anyway, I've created an exception if for that, and im going to create pull request. it's up to you guys if to get it or not, but I think it will be good idea.

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

3 participants