angular: Angular CLI build fails with allowJs: true fails when there is javascript file in src folder
I’m submitting a…
[x] Regression (a behavior that used to work and stopped working in a new release)
Current behavior
ng serve fails if there is any javascript file in src directory
Expected behavior
build should work just fine, last working version angular 4.x
Minimal reproduction of the problem with instructions
create new project with ng new projectname
modify the tsconfig.json
to set "allowJs": true
create new file .js file in src/app
run ng serve
What is the motivation / use case for changing the behavior?
Environment
Angular version: 5.1.1
Browser:
- [ x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 8.9.3
- Platform: Windows 10
Others:
@angular/cli 1.6.1
it’s not fixed by related bug https://github.com/angular/angular/issues/19757#issuecomment-352490677
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 15
- Comments: 41 (4 by maintainers)
Links to this issue
Commits related to this issue
- fix(@ngtools/webpack): do not remove outDir from the configuration It would overwrite JavaScript files in the source directory. Even if its a virtual compiler host, this is still a BAD THING and Type... — committed to hansl/angular-cli by hansl 7 years ago
- fix(@ngtools/webpack): do not remove outDir from the configuration It would overwrite JavaScript files in the source directory. Even if its a virtual compiler host, this is still a BAD THING and Type... — committed to hansl/angular-cli by hansl 7 years ago
- fix(@ngtools/webpack): do not remove outDir from the configuration It would overwrite JavaScript files in the source directory. Even if its a virtual compiler host, this is still a BAD THING and Type... — committed to hansl/angular-cli by hansl 7 years ago
- build(dep): update `angular` & it dependencies incl. firebase, material - Known issues: - https://github.com/angular/angular/issues/21080 - https://github.com/angular/angular/issues/19757#issueco... — committed to PhilippeMorier/spiti-ui by PhilippeMorier 6 years ago
- fix(@ngtools/webpack): do not remove outDir It would overwrite JavaScript files in the source directory. Even if its a virtual compiler host, this is still a BAD THING and TypeScript complains. Fixe... — committed to hansl/angular-cli by hansl 6 years ago
- fix(@ngtools/webpack): do not remove outDir It would overwrite JavaScript files in the source directory. Even if its a virtual compiler host, this is still a BAD THING and TypeScript complains. Fixe... — committed to hansl/angular-cli by hansl 6 years ago
- fix(@ngtools/webpack): suppress warnings for overwriting files in tsc Since we're using a virtual filesystem, overwriting files by tsc does not affect actual files on the filesystem. This allows us t... — committed to hansl/angular-cli by hansl 6 years ago
- fix(@ngtools/webpack): suppress warnings for overwriting files in tsc Since we're using a virtual filesystem, overwriting files by tsc does not affect actual files on the filesystem. This allows us t... — committed to angular/angular-cli by hansl 6 years ago
- fix(@ngtools/webpack): suppress warnings for overwriting files in tsc Since we're using a virtual filesystem, overwriting files by tsc does not affect actual files on the filesystem. This allows us t... — committed to angular/angular-cli by hansl 6 years ago
- fix(@ngtools/webpack): suppress warnings for overwriting files in tsc Since we're using a virtual filesystem, overwriting files by tsc does not affect actual files on the filesystem. This allows us t... — committed to angular/angular-cli by hansl 6 years ago
- fix(@ngtools/webpack): suppress warnings for overwriting files in tsc Since we're using a virtual filesystem, overwriting files by tsc does not affect actual files on the filesystem. This allows us t... — committed to d2clouds/speedray-cli by hansl 6 years ago
Any idea as to when this issue will be resolved? I have to update my project to material 5 which depends on ng5 which fails on build with
allowJs
.@ameya after you get this error you must save any .ts file to start the transpile process again, then you’ll get no error.
cd path/to/chartist-plugins
npm init
(just enter for all questions)cd path/to/your/angular/project
install-local /path/to/the/chartist-plugins/directory
(assumed you have already installed install-local)But how to run it when using CI like jenkins? Makes no sense to me.
@elvisfernandes thanks for the help we can work with the workaround now. I missed out the purpose of --watch=auto by @neoncube2. Thanks for the help 😃
Hi @hansl, is there any update on this issue is resolved? As we already have a production-ready application build from angular 5 downgrading to angular 4 is not an option for us. Because of this one blocker, we are thinking of breaking only the external js dependant part into angular 4 application that will be used in angular 5 application via html iFrames. Any ETA date so we can hold on to bug to avoid unnecessary extra work?
Anyone has a workaround for Angular 5. Install local does not work on my windows machine. link. @vladimiry workaround also did not work out.
ERROR in src/app/jsplumb/jsplumb.component.ts(7,16): error TS2304: Cannot find name 'require'.
@hansl is there any ETA on this PR it has been a blocker in my project.
I’ve got this issue with an imported JS file outside the src directory too:
ERROR in error TS5055: Cannot write file '<JS FILE PATH>' because it would overwrite input file.