AllowJS not working on Angular

I have JS files / libraries included in my Angular project and it is inside my resource folder. Earlier on Angular 4 or 2, I had no problem setting AllowJS to true in the compiler options, but when I upgraded to Angular 5 (CLI + Typescript), this will not work, and it says

error TS5055: Cannot write file '<a path/afile.js>' because it would overwrite input file.

A single inclusion allowJS(without importing into my typescript files) throws an error when on ng serve or ng build. Also, deleting it successfully serves / builds my project, but I need to enable JS.

Here is my tsconfig.app.json

    {
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "allowJs": true,
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []

  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

Here is my version of Angular + other information

Angular CLI: 1.5.4
Node: 8.9.1
OS: win32 x64
Angular: 5.0.0
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cdk: 5.0.0-rc.1-6e865b7
@angular/cli: 1.5.4
@angular/language-service: 4.4.6
@angular/material: 5.0.0-rc.1-6e865b7
@angular-devkit/core: 0.0.21
@angular-devkit/schematics: 0.0.37
@schematics/angular: 0.1.7
typescript: 2.4.2
webpack: error

Please help as another solution and this does not work. Thank!

+4
source share
1

tsconfig.json

{
 "compileOnSave": false,
 "compilerOptions": {
 "declaration": false,
 "emitDecoratorMetadata": true,
 "experimentalDecorators": true,
 "module": "commonjs",
 "moduleResolution": "node",
 "outDir": "../dist/out-tsc-e2e",
 "sourceMap": true,
 "target": "es5",
 "allowJs": true,
 "typeRoots": [
   "../node_modules/@types"
 ]
}}

Angular :

  / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
 / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
/ ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
              |___/

Angular CLI: 1.6.0
Node: 9.3.0
OS: linux x64
Angular: 5.1.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0
+1

Source: https://habr.com/ru/post/1689926/


All Articles