-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): use baseUrl and paths from tsconfig
- Loading branch information
1 parent
b224395
commit 8b8c5ff
Showing
5 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import {updateTsConfig} from '../../utils/project'; | ||
import {writeMultipleFiles, appendToFile} from '../../utils/fs'; | ||
import {ng} from '../../utils/process'; | ||
import {stripIndents} from 'common-tags'; | ||
|
||
|
||
export default function() { | ||
return updateTsConfig(json => { | ||
json['compilerOptions']['baseUrl'] = '.'; | ||
json['compilerOptions']['paths'] = { | ||
'@shared': [ | ||
'app/shared' | ||
], | ||
'@shared/*': [ | ||
'app/shared/*' | ||
] | ||
}; | ||
}) | ||
.then(() => writeMultipleFiles({ | ||
'src/shared/meaning.ts': 'export var meaning = 42;', | ||
'src/shared/index.ts': `export * from './meaning'` | ||
})) | ||
.then(() => appendToFile('src/app/app.component.ts', stripIndents` | ||
import { meaning } from 'app/shared/meaning'; | ||
import { meaning as meaning2 } from '@shared'; | ||
import { meaning as meaning3 } from '@shared/meaning'; | ||
// need to use imports otherwise they are ignored and | ||
// no error is outputted, even if baseUrl/paths don't work | ||
console.log(meaning) | ||
console.log(meaning2) | ||
console.log(meaning3) | ||
`)) | ||
.then(() => ng('build')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters