Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class DedupeModuleResolvePlugin {
const { descriptionFileData, relativePath } = resourceResolveData;

// Empty name or versions are no valid primary entrypoints of a library
if (!descriptionFileData.name || !descriptionFileData.version) {
if (!descriptionFileData?.name || !descriptionFileData?.version) {
return;
}

Expand Down
56 changes: 31 additions & 25 deletions tests/legacy-cli/e2e/tests/build/ts-paths.ts
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
import {updateTsConfig} from '../../utils/project';
import {writeMultipleFiles, appendToFile, createDir, replaceInFile} from '../../utils/fs';
import {ng} from '../../utils/process';
import {stripIndents} from 'common-tags';
import { stripIndents } from 'common-tags';
import { appendToFile, createDir, replaceInFile, rimraf, writeMultipleFiles } from '../../utils/fs';
import { ng } from '../../utils/process';
import { updateTsConfig } from '../../utils/project';


export default function() {
// TODO(architect): Delete this test. It is now in devkit/build-angular.

return updateTsConfig(json => {
export default async function () {
await updateTsConfig(json => {
json['compilerOptions']['baseUrl'] = './src';
json['compilerOptions']['paths'] = {
'@shared': [
'app/shared'
'app/shared',
],
'@shared/*': [
'app/shared/*'
'app/shared/*',
],
'@root/*': [
'./*'
]
'./*',
],
};
})
.then(() => createDir('src/app/shared'))
.then(() => writeMultipleFiles({
});

await createDir('src/app/shared');
await writeMultipleFiles({
'src/meaning-too.ts': 'export var meaning = 42;',
'src/app/shared/meaning.ts': 'export var meaning = 42;',
'src/app/shared/index.ts': `export * from './meaning'`,
}))
.then(() => replaceInFile('src/app/app.module.ts', './app.component', '@root/app/app.component'))
.then(() => ng('build'))
.then(() => updateTsConfig(json => {
});

await replaceInFile('src/app/app.module.ts', './app.component', '@root/app/app.component');
await ng('build');

await updateTsConfig(json => {
json['compilerOptions']['paths']['*'] = [
'*',
'app/shared/*'
'app/shared/*',
];
}))
.then(() => appendToFile('src/app/app.component.ts', stripIndents`
});

await 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';
Expand All @@ -49,6 +50,11 @@ export default function() {
console.log(meaning3)
console.log(meaning4)
console.log(meaning5)
`))
.then(() => ng('build'));
`);

await ng('build');

// Simulate no package.json file which causes Webpack to have an undefined 'descriptionFileData'.
await rimraf('package.json');
await ng('build');
}