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

How to use isomorphic-style-loader with third party component library? #158

Open
dmngu9 opened this issue May 1, 2019 · 3 comments
Open

Comments

@dmngu9
Copy link

dmngu9 commented May 1, 2019

In my webpack config I include isomorphic-style-loader and the third party component comprise of js and scss file. When i ran webpack, the styles of the third party component is not loaded in the head tag in the HTML sent from server

My question is do i need to wrap that component with withStyles with its own stylesheet?

@nickinnon
Copy link

I'm also looking for a solution to this.

@nickinnon
Copy link

I ended up creating another style sheet that imported the vendor styles. The component followed a standard classes API that allowed me to inject the class names that were generated from the import.

@piglovesyou
Copy link
Contributor

In isomorphic-style-loader you need to insertCss explicitly somewhere. If the third party component provides .scss why don't you try this

import {ThirtPartyComp} from 'third-party-comp';
import thirdPartyCompStyle from 'third-party-comp/lib/style.scss';
import s from './your-style.scss';

const YourComponent = () => (
  <div>
    <ThirtPartyComp />
  <div>
);

export default withStyles(thirdPartyCompStyle, s)(YourComponent);

Please note that you probably need !css-loader?modules=false loader option of Webpack.

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