Importing Less file into component throws package not declared in dependencies error
See original GitHub issueThis doesn’t really fit a bug template, I am just looking for guidance on this issue I’m facing. I am using a Next.js application and in my webpack config I have the following alias defined:
module.exports = {
webpack(config) {
// Setting up alias for absolute imports
config.resolve.alias['@Components'] = path.join(__dirname, 'components');
return config;
}
};
This allows me to import components anywhere in my application from that folder like so:
import Button from '@Component/Button`
When using Yarn 2, I get the following error message:
./components/Button/index.js
Module not found: Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies
Any suggestion on how to resolve this issue? Prior to switching to Yarn 2, it was working well. Thanks.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
vue.js - Importing lib's css inside the component styles is ...
However when I import the styles it throws a loader error about dependency not found. What is wrong and how can I fix...
Read more >no-extraneous-dependencies doesn't support nested package ...
Run 'npm i -S react' to add it import/no-extraneous-dependencies 2:1 error 'classnames' should be listed in the project's dependencies.
Read more >API - esbuild
To join a set of files together with esbuild, import them all into a single entry point file and bundle just that one...
Read more >Migrating from v2 to v3 - Gatsby
Part of that huge ecosystem includes dependency trees! Depending on how the plugin authors have declared dependencies (e.g. marking a package as a...
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
Update, so I forked the
next-css
andnext-less
repos and updated their loaders to userequire.resolve
. That seems to have resolved the issue.Just to make sure, did you run yarn after adding it?