Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json-typescript-mapper\libs\utils.ts is not part of the compilation output #33

Open
huskercane opened this issue Nov 13, 2017 · 9 comments

Comments

@huskercane
Copy link

Hello,

I see following trying to build angular 5 application. This used to work with angular 4.

C:\Work\assurant\XXXManagementApp [angular-5 ≡ +0 ~1 -0 !]> npm start

[email protected] start C:\Work\assurant\XXXManagementApp
ng serve --proxy-config ./proxy.conf.js

** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2017-11-13T14:12:31.724Z
Hash: f6282ae4985825752bad
Time: 24660ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 659 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 971 kB [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 150 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 20.2 MB [initial] [rendered]

ERROR in ./node_modules/json-typescript-mapper/libs/utils.ts
Module build failed: Error: C:\Work\assurant\XXXManagementApp\node_modules\json-typescript-mapper\libs\utils.ts is not part of the compilation output. Pl
ease check the other error messages for details.
at AngularCompilerPlugin.getCompiledFile (C:\Work\assurant\XXXManagementApp\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:629:23)
at plugin.done.then (C:\Work\assurant\XXXManagementApp\node_modules@ngtools\webpack\src\loader.js:467:39)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
@ ./node_modules/json-typescript-mapper/index.js 3:14-37
@ ./src/app/metric.service.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts

webpack: Failed to compile.

I found this link that could explain
angular/angular-cli#8284

so I tried adding include to tsconfig.json but that did not solve it

@owennewo
Copy link

@huskercane - I got the same error (also using angular 5) and have resolved it. You are onto the right track with the include.
Here is my working 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"
    ]
  },
  "include": [
    "src/**/*",
    "node_modules/json-typescript-mapper/libs/utils.ts"
  ]
}

So I've basically just add the include section. You need to be careful not to put it at the wrong level.

Reading around the issue, the above solution is a workaround. The json-typescript-mapper should not be shipping the utils.ts file to npm, the utils.js and utils.d.ts is sufficient. Another workaround is therefore to delete node_modules/json-typescript-mapper/libs/utils.ts - however I expect the file may come back on a npm clean or update.

@huskercane
Copy link
Author

@owennewo your suggestion does solve the problem. This is proper work around thank you.

@Sir-J
Copy link

Sir-J commented Dec 2, 2017

It's not helped me

@BBaysinger
Copy link

I tried @owennewo's solution, but got:

error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["src/**/*","node_modules/json-typescript-mapper/libs/utils.ts"]' and 'exclude' paths were '["../dist/out-tsc"]'.

@BBaysinger
Copy link

Ok, I fixed that by adding ../ to both paths.

@Rajashreegr
Copy link

I'm getting the same error while running ng-test, even though I have added in tsconfig file.

{
"compileOnSave": false,
"compilerOptions": {
"module": "commonjs",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
},
"exclude": [
"node_modules"
],
"include": [
"src/**/*",
"node_modules/json-typescript-mapper/libs/utils.ts"
]
}

I don't have any issue while running the application but it fails while I run the test cases.
Typescript version Used: "typescript": "~2.5.3"

RROR in ./node_modules/json-typescript-mapper/libs/utils.ts
Module build failed: Error: ..\node_modules\json-typescript-mapper\libs\utils.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

I also added the "node_modules/json-typescript-mapper/libs/utils.ts" in 'tsconfig.spec.json but still facing the same issue.

@Rajashreegr
Copy link

Rajashreegr commented Apr 12, 2018

The above error was actually my issue. I solved it by correcting the utils.ts path in tsconfig.spec.json file.
"../node_modules/json-typescript-mapper/libs/utils.ts" (I missed ../ before).

@DiegoVenancioVieira
Copy link

I still getting this problem, please somebody help:

tsconfig:

{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": [],
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": [
"src//*",
"../node_modules/json-typescript-mapper/libs/utils.ts"
],
"exclude": [
"test.ts",
"
/*.spec.ts"
]
}

ERROR;

ERROR in ./src/main.ts
Module build failed: Error: C:...\src\main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:...\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (C:...\node_modules@ngtools\webpack\src\loader.js:467:39)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
ERROR in ./src/polyfills.ts
Module build failed: Error: C:...\src\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:...\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (C:...\node_modules@ngtools\webpack\src\loader.js:467:39)
at

webpack: Failed to compile.

@eddie007bkk
Copy link

Working for me
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": [],
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include":[
"../src//*",
"../node_modules/json-typescript-mapper2/libs/utils.ts"
],
"exclude": [
"test.ts",
"
/*.spec.ts"
]

vhive-jonathan-carse added a commit to vhive-jonathan-carse/json-typescript-mapper that referenced this issue Oct 27, 2019
Solves ng serve bug, see jf3096#33 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants