-
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(@angular-devkit/build-angular): don't bundle linked modules when …
…`bundleDependencies` in `none` in server builder Fixes #13817
- Loading branch information
Showing
2 changed files
with
71 additions
and
22 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
66 changes: 66 additions & 0 deletions
66
tests/legacy-cli/e2e/tests/misc/universal-bundle-dependencies.ts
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,66 @@ | ||
import * as path from 'path'; | ||
import { | ||
createDir, | ||
expectFileToMatch, | ||
rimraf, | ||
symlinkFile, | ||
writeMultipleFiles, | ||
} from '../../utils/fs'; | ||
import { ng } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
export default async function() { | ||
await updateJsonFile('angular.json', workspaceJson => { | ||
const appArchitect = workspaceJson.projects['test-project'].architect; | ||
appArchitect['server'] = { | ||
builder: '@angular-devkit/build-angular:server', | ||
options: { | ||
bundleDependencies: 'none', | ||
outputPath: 'dist/test-project-server', | ||
main: 'src/main.server.ts', | ||
tsConfig: 'tsconfig.server.json', | ||
}, | ||
}; | ||
}); | ||
|
||
await createDir('./dummy-lib'); | ||
|
||
await writeMultipleFiles({ | ||
'./tsconfig.server.json': ` | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../dist-server", | ||
"baseUrl": "./", | ||
"module": "commonjs", | ||
"types": [] | ||
}, | ||
"include": [ | ||
"src/main.server.ts" | ||
] | ||
} | ||
`, | ||
'./src/main.server.ts': ` | ||
import { dummyVersion } from 'dummy-lib'; | ||
console.log(dummyVersion); | ||
`, | ||
// create a dummy library | ||
'./dummy-lib/package.json': `{ | ||
"name": "dummy-lib", | ||
"version": "0.0.0", | ||
"typings": "./main.d.ts", | ||
"main": "./main.js" | ||
}`, | ||
'./dummy-lib/main.js': 'export const dummyVersion = 1', | ||
'./dummy-lib/main.d.ts': 'export declare const dummyVersion = 1', | ||
}); | ||
|
||
await symlinkFile(path.resolve('./dummy-lib'), path.resolve('./node_modules/dummy-lib'), 'dir'); | ||
|
||
await ng('run', 'test-project:server'); | ||
// when preserve symlinks is true, it should not included node_modules in the bundle | ||
await expectFileToMatch('dist/test-project-server/main.js', 'require("dummy-lib")'); | ||
|
||
// cleanup the package | ||
await rimraf('node_modules/dummy-lib'); | ||
} |