I want to set up development, test(QA) and PROD environment for my Angular 2 project.
While going for QA env set up ng build --environment=qa
I am getting below error
Cannot read property 'length' of undefined at createSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15457:109) at parseSourceFileWorker (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15389:26) at Object.parseSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15338:26) at Object.createSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:15192:29) at VirtualFileStats.getSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\@ngtools\webpack\src\compiler_host.js:66:35) at WebpackCompilerHost.getSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\@ngtools\webpack\src\compiler_host.js:213:38) at findSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67909:29) at processImportedModules (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:68056:25) at findSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67937:17) at processSourceFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67840:27) at processRootFile (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67728:13) at D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67018:60 at Object.forEach (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:1449:30) at Object.createProgram (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\typescript\lib\typescript.js:67018:16) at AotPlugin._setupOptions (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\@ngtools\webpack\src\plugin.js:129:28) at new AotPlugin (D:\ECC Web\ECC WEB\working\8-Aug\node_modules\@ngtools\webpack\src\plugin.js:26:14)
Below is my code for environment set up in angular-cli.json
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts",
"qa": "environments/environment.qa.ts"
}
in environments/environment.qa.ts
export const environment = {
production: false
};
environment.*.ts
files and the config underenvironments
in.angular-cli.json
. In my case, it was just a typo:envrionment.qa.ts
instead ofenvironment.qa.ts
. – San