Jest = Can not find module
See original GitHub issueHello,
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>
)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
node.js - Jest gives `Cannot find module` when importing ...
I think you're looking for: roots or modulePaths and moduleDirectories. You can add both relative and absolute paths.
Read more >Upgrade to v28 complains "Cannot find module '@jest/ ...
This is was fixed it for me. I removed resolver: 'jest-node-exports-resolver' and changed it from: module.
Read more >Configuring Jest
Jest will run .mjs and .js files with nearest package.json 's type field set to module as ECMAScript Modules.
Read more >cannot find module 'jest-util'
If you are seeing the error "cannot find module 'jest-util'" when running a test in Jest [1][2], it is likely that you are...
Read more >jest: configuring jest to resolve modules - code-comments
jest : configuring jest to resolve modules ; const path = require( ; import app from "./app.js" import ; find module 'usefulModule' ·...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
🤔 This may be an issue with sass-extract-loader rather than this plugin.
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.