Importing children components. Module not found: Error: Can't resolve
See original GitHub issueTo start, I’ve been successful with all of vue-styleguidist up to this point. The moment I imported a component into another component I’m met with Module not found
.
Dependencies:
"typescript": "~4.5.2",
"vue-loader": "^15.0.0",
"vue": "2.6.14",
"vue-property-decorator": "^9.1.2",
"vue-style-loader": "^4.1.3",
"vue-styleguidist": "^4.45.1",
"ts-loader": "^9.3.1",
"webpack": "^5.0.0",
Full error:
Module not found: Error: Can't resolve '../ui-comp-chip' in '/correct/path/to/component'
[tsl] ERROR in /correct/path/to/ui-comp/UiComp.ts(8,26)
TS2307: Cannot find module '../ui-comp-child/UiCompChild.vue' or its corresponding type declaration
Below is the file directory with corresponding files that may paint a picture of what I am doing. For the sake of brevity, I’ve removed any information that is unnecessary to solve the problem.
lib/
├─ ui-comp/
│ ├─ index.ts
│ ├─ UiComp.ts
│ ├─ UIComp.Vue
├─ ui-comp-child/
│ ├─ index.ts
│ ├─ UiCompChild.ts
│ ├─ UiCompChild.vue
// ui-comp/UiComp.ts
import { Vue, Component, Prop } from 'vue-property-decorator';
import UiCompChild from '../ui-comp-child';
@Component({
components: {
UiChipAction,
},
})
export default class UiComp extends Vue {}
// ui-comp/UiComp.vue
<template>
<span>
<ui-comp-child></ui-comp-child>
</span>
</template>
<script lang="ts" src="./UiComp.ts"></script>
// ui-comp/index.ts
import UiComp from './UiComp.vue';
export default UiComp;
// styleguide.config.js
module.exports = {
...
components: [
path.join(process.cwd(), 'path/to/files/', '**/*.vue')
],
webpackConfig() {
return {
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: { appendTsSuffixTo: [/\.vue$/] }
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
]
}
]
},
plugins: [ new VueLoaderPlugin() ],
}
}
}
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Module not found: Error: Can't resolve child component
It compiles well but I get a runtime error that the child component is not resolved. BookStore.tsx (parent component) import { SearchBooks, ...
Read more >NextJS Module not found: Can't resolve 'components/layout'
Hello. I was want to try gts in my project. After 'npx gts init' when I try to start my project I getting...
Read more >Troubleshooting | React Navigation
Troubleshooting. This section attempts to outline issues that users frequently encounter when first getting accustomed to using React Navigation.
Read more >NgModule FAQ - Angular
An NgModule can even export a module that it doesn't import. What should I not export?link. Don't export the following: Private components, directives,...
Read more >FAQs - styled-components
If you think that the issue is in duplicated styled-components module somewhere in your dependencies, there are several ways to check this. You...
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 Free
Top 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
hello @whosdustin,
The investigation is going well:
shims-vue.d.ts
. Perhaps this file is in your project but not in scope of thetsconfig.json
.../ui-child
to../ui-child/index.ts
. I think it has to do with thetsconfig
. Let me check.Thank you so much! It’s always the simplest things that one can miss. I appreciate you taking the time to help me.