馃悶 Bug report
Command (mark with an x)
- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description
Javascript files are mapped to transpiled code instead of the original code.
馃敩 Minimal Reproduction
Create new app
ng new testsourcemap
cd testsourcemap
Add '"allowJs": true' in compilerOptions section of tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"allowJs": true,
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
Create file testjs.js in src/app
function add(a,b){
return a+b;
}
export {
add
};
Change app.component.ts to
import { Component } from '@angular/core';
import * as test from './testjs';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'testsourcemap';
constructor() {
let add = test.add;
}
}
馃敟 Exception or Error
The mapped file 'webpack:///./src/app/testjs.js' under Chrome shows the following code
import * as tslib_1 from "tslib";
function add(a, b) {
return a + b;
}
export { add };
//# sourceMappingURL=testjs.js.map
馃實 Your Environment
Angular CLI: 8.3.8
Node: 10.15.3
OS: win32 x64
Angular: 8.2.10
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.8
@angular-devkit/build-angular 0.803.8
@angular-devkit/build-optimizer 0.803.8
@angular-devkit/build-webpack 0.803.8
@angular-devkit/core 8.3.8
@angular-devkit/schematics 8.3.8
@angular/cli 8.3.8
@ngtools/webpack 8.3.8
@schematics/angular 8.3.8
@schematics/update 0.803.8
rxjs 6.4.0
typescript 3.5.3
webpack 4.39.2
Anything else relevant?
馃悶 Bug report
Command (mark with an
x)Description
Javascript files are mapped to transpiled code instead of the original code.
馃敩 Minimal Reproduction
Create new app
Add '"allowJs": true' in compilerOptions section of tsconfig.json
Create file testjs.js in src/app
Change app.component.ts to
馃敟 Exception or Error
The mapped file 'webpack:///./src/app/testjs.js' under Chrome shows the following code
馃實 Your Environment
Anything else relevant?