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

import scss file within jsx file not working #247

Open
centinel3 opened this issue Apr 26, 2017 · 4 comments
Open

import scss file within jsx file not working #247

centinel3 opened this issue Apr 26, 2017 · 4 comments

Comments

@centinel3
Copy link

Hi there fourseven,

This plugin is great, though am having some issues with importing an accompanying scss file into my react jsx component. I dug through the issues log as well as google and can't seem to figure this out. Is there any way to import an scss file into a jsx file from the same directory?

file structure:

-imports
--features
---invite-form
----invite-form.jsx
----invite-form.scss

React component:

import React from 'react';
import './invite-form.scss';

const InviteForm = (props) => (

this is a form

);

export default InviteForm;

@idanwe
Copy link

idanwe commented Nov 5, 2017

@centinel3 did you find a solution?

@jmendiola222
Copy link

same issue here

@Floriferous
Copy link

This would be great to allow for better css code-splitting!

@nathanschwarz
Copy link

It works well for me.

I think your issue is not with importing the scss file, I struggled to understand why the app crashed when the scss file had the same filename as the .jsx file.

Make sure you import your JSX file with the .jsx extension when a scss file has the same filename in the directory; otherwise it will import randomly the scss file instead (because import is async).

do : import X from '/imports/..../X.jsx' instead of import X from '/imports/..../X'

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

5 participants