Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Untrue 'not found' warnings in Angular-CLI/Webpack project

I'm getting a bunch of warnings like the following that things cannot be found but they are in the right places and my app runs so the warnings must be wrong. I'm using webpack version 2.1.0-beta.22 and webpack-dev-server 2.1.0-beta.10. My project is on GitHub here

Do you know how I can fix this? Thanks!

[WDS] Warnings while compiling.
client:73 ./src/app/debate/claim/claim.component.ts
38:55 export 'Claim' was not found in '../../core/store/claim/claim.model'
Error: export 'Claim' was not found in '../../core/store/claim/claim.model'
    at HarmonyImportSpecifierDependency.getWarnings (/Users/Dan/work/bernierebuttals/gba/node_modules/angular-cli/node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:34:14)
    at /Users/Dan/work/bernierebuttals/gba/node_modules/angular-cli/node_modules/webpack/lib/Compilation.js:645:21
    at Array.forEach (native)
    at /Users/Dan/work/bernierebuttals/gba/node_modules/angular-cli/node_modules/webpack/lib/Compilation.js:644:22
    at Array.forEach (native)
    at Compilation.reportDependencyWarnings (/Users/Dan/work/bernierebuttals/gba/node_modules/angular-cli/node_modules/webpack/lib/Compilation.js:643:9)
    at Compilation.<anonymous> (/Users/Dan/work/bernierebuttals/gba/node_modules/angular-cli/node_modules/webpack/lib/Compilation.js:505:8)
    at Array.forEach (native)
    at Compilation.finish 

Full stack trace

The file structure looks like this:

app
├── core

│   ├── store

│   │   ├── claim
│   │   │   ├── README.md
│   │   │   ├── claim.actions.ts
│   │   │   ├── claim.effects.ts
│   │   │   ├── claim.model.ts
│   │   │   └── claim.reducer.ts

├── debate
│   ├── README.md
│   ├── claim
│   │   ├── claim.component.css
│   │   ├── claim.component.html
│   │   ├── claim.component.spec.ts
│   │   └── claim.component.ts

and from ./src/app/core/store/claim/claim.model.ts

import { Rebuttal } from '../rebuttal/rebuttal.model';

export interface Claim {
...
like image 448
Dan Cancro Avatar asked Nov 09 '16 18:11

Dan Cancro


1 Answers

Maybe these links can solve your problem: [1] and [2]

So I tried to add a new file to export only in the interface, and the warnings are gone:

I created the interfaces file for claim, claim-rebuttal and rebuttal:

/** /src/app/core/store/claim/claim.interface.ts */
export { Claim } from './claim.model'


/** /src/app/core/store/claim-rebuttal/claim-rebuttal.interface.ts */
export { ClaimRebuttal } from './claim-rebuttal.model'


/** /src/app/core/store/rebuttal/rebuttal.interface.ts */
export { Rebuttal } from './rebuttal.model'

Then I exported this in the index.ts

export { Claim } from './claim/claim.interface'
export { Rebuttal } from './rebuttal/rebuttal.interface'
export { ClaimRebuttal } from './claim-rebuttal/claim-rebuttal.interface'

Finally, it just to change it in the claim.component and others files:

import { Claim, Rebuttal, ClaimRebuttal }  from '../../core/store';
// ...

@Component({ ...})
export class ClaimComponent {

and also in rebuttal component:

import { Rebuttal, Claim }  from '../../core/store';

@Component({...})
export class RebuttalComponent implements OnInit {
...
like image 52
Celso Agra Avatar answered Sep 20 '22 02:09

Celso Agra