I'm having trouble making reference to files that are in the same folder when working with a file of type barrel in my project is in Angular (version: ^ 4.0.0). My problem is this, look at the structure of files and directories below:
|-app
|-index.ts
|-app.module.ts
|-app.routes.ts
|-app.component.ts
|-foo
|-index.ts
|-foo.module.ts
|-foo.routes.ts
|-foo.component.ts
The two files of type index, contains a simple structure of "barrel" files, as shown here:
app / index.ts
export * from './app.module';
export * from './app.routes';
export * from './app.component';
app / foo / index.ts
export * from './foo.module';
export * from './foo.routes';
export * from './foo.component';
My problem is, when I'm in any file inside the app
directory, I can call a barrel reference from foo, like this:
app.module.ts
import { FooRoutes, FooComponent } from './foo' // -> vai reconhecer o barrel
...
But if I inside the app/foo
directory try to search for an existing file in its own barrel of error, it says that the element could not be found (returns undefined
). Serial something like:
foo.module.ts
import { FooComponent } from '../foo' // -> não acha
import { FooComponent } from '..' // -> não acha
import { FooComponent } from 'foo' // -> não acha
//wtf???
...
Can anyone help me solve this problem?