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

Jest = Can not find module #12

Open
remijean opened this issue Jun 3, 2019 · 5 comments
Open

Jest = Can not find module #12

remijean opened this issue Jun 3, 2019 · 5 comments

Comments

@remijean
Copy link

remijean commented Jun 3, 2019

Hello,

I have a problem with Jest, when I run a test I have this error:

Cannot find module 'sass-extract-loader?{"plugins": ["sass-extract-js"]}!./theme/variables.scss' from 'index.tsx'

My code :

const theme = require('sass-extract-loader?{"plugins": ["sass-extract-js"]}!./theme/variables.scss')

ReactDOM.render(
  <ThemeProvider theme={theme}>
    ...
  </ThemeProvider>
)
@adamgruber
Copy link
Owner

🤔 This may be an issue with sass-extract-loader rather than this plugin.

@rcwestlake
Copy link

rcwestlake commented Jul 6, 2019

@remijean I'm seeing the same thing. Did you resolve it?

@remijean
Copy link
Author

@rcwestlake no, I have not found a solution, but I mentioned the issue here jgranstrom/sass-extract-loader#7.

@adi518
Copy link

adi518 commented Aug 12, 2019

No Jest support is a deal-breaker and the workaround posted in jgranstrom/sass-extract-loader#7 isn't good enough.

@adamgruber
Copy link
Owner

Unfortunately this is a limitation with jest-resolver not understanding the webpack import syntax.

You could try mocking the loader similar to how it's done in this issue.

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

4 participants