In my nuxt directory structure I have a folder called modules which contains my custom modules. In this example it will contain the modules foo and bar. In nuxt.config.js foo is added like so:
// nuxt.config.js
...
modules: [
...
"~/modules/foo"
],
...
Note bar is not added as a module.
When I try to import bar in foo
// foo/index.ts
import { bar } from '~/modules/bar';
export default function fooModule() {
console.log(bar)
}
// bar/index.ts
const bar = 1
export { bar };
export default function barModule() {}
I get Nuxt Fatal Error, Error: Cannot find module '~/modules/bar'.
Adding "~/modules/bar" to modules in nuxt.config.js seems to make no difference.
Any Idea on how to prevent this?