9
when I try to run the angular server to test the project it fails to build with the following error:
ERROR in ./src/app/shared/objeto/Venda.ts
Module build failed: Error: F:\Xampp\htdocs\www\Angular\fidaliza\src\app\shared\objeto\Venda.ts is missing from the TypeScript compilation.
Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (F:\Xampp\htdocs\www\Angular\fidaliza\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (F:\Xampp\htdocs\www\Angular\fidaliza\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
everything was working normal until I created this class:
export class Venda {
venda_cliente: string;
venda_loja: string;
venda_cupom: number;
venda_produtos: number;
venda_valor: number;
venda_resgate: number;
venda_dtresgate: string;
resgatar: boolean;
}
the error occurs when this line is executed:
@Input() venda: Venda = new Venda();
when I comment the line above it runs normal application, already tried to do path includes in the tsconfig.app
and tsconfig.spec
but did not resolve.
tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
tsconfig.spec.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
resgatar.component.ts
import { Component, OnInit, Input } from '@angular/core';
import { routerTransition } from '../../../router.animations';
import { ClientesService } from '../../../shared/services /clientes.service';
import { VendasService } from '../../../shared/services/vendas.service';
import { Cliente } from '../../../shared/objeto/cliente';
import { Venda } from '../../../shared/objeto/Venda';
import { FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'app-resgatar',
templateUrl: './resgatar.component.html',
styleUrls: ['./resgatar.component.scss'],
animations: [routerTransition()],
})
export class ResgatarComponent implements OnInit {
@Input() venda: Venda = new Venda();
{restante da classe acho que não é util pois só tem funções de botões}
when I did this include
"include: ["**/*.d.ts"]
in thetsconfig.app.json
no build error, but the application is only loading and no error appears in the console!
Have you upgraded from Angular 4 to Angular 5? If so, try running
ng serve --preserve-symlinks
and see if it works. If it doesn’t, please include the filestsconfig.app.json
,tsconfig.spec.json
and the Imports file ts that has the line@Input() venda: Venda = new Venda();
– mercador
@merchant I did as you said
ng serve --preserve-symlinks
had already tried, I’m searching the blog angular to try to fix this without success, I started the project already coom angular 5 did not upgrade, only thing I did was update the@angular/cli
because it gave a bug and I thought better to reinstall but I think that is not it pq as said without the line it runs normally– Hebert Lima