Skip to content

Commit a4cf911

Browse files
committed
fixup! fix(@angular/build): improve library bundler resolution and watch shared chunk consistency
1 parent 56c6a54 commit a4cf911

2 files changed

Lines changed: 1 addition & 41 deletions

File tree

‎packages/angular/build/src/builders/library/pipeline/bundler.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ function createMemoryFileLoaderPlugin(
290290
return files.has(id) ? { id, external: false } : undefined;
291291
}
292292

293-
if (id[0] !== '.' && !path.posix.isAbsolute(id) && !/^[a-zA-Z]:\//.test(id)) {
293+
if (id[0] !== '.' && !path.isAbsolute(id)) {
294294
return { id, external: true };
295295
}
296296

‎packages/angular/build/src/builders/library/pipeline/bundler_spec.ts‎

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -141,46 +141,6 @@ export * from './nested///';`,
141141
);
142142
});
143143

144-
it('should treat Windows drive-letter absolute paths as internal modules', async () => {
145-
const winProjectRoot = 'C:/workspace/projects/my-lib';
146-
const primary = createEntryPoint('.', 'my-lib', `${winProjectRoot}/src/public-api.ts`);
147-
const options = createOptions([primary], {
148-
workspaceRoot: 'C:/workspace',
149-
projectRoot: winProjectRoot,
150-
outputPath: 'C:/workspace/dist/my-lib',
151-
});
152-
153-
const esmFiles = new Map<string, string>([
154-
[`${winProjectRoot}/src/public-api.js`, `export * from '${winProjectRoot}/src/win-mod';`],
155-
[`${winProjectRoot}/src/win-mod.js`, `export const WIN_CONST = 'win-ok';`],
156-
]);
157-
158-
const dtsFiles = new Map<string, string>([
159-
[`${winProjectRoot}/src/public-api.d.ts`, `export * from '${winProjectRoot}/src/win-mod';`],
160-
[`${winProjectRoot}/src/win-mod.d.ts`, `export declare const WIN_CONST: string;`],
161-
]);
162-
163-
const output = await bundleEntryPoints(
164-
[{ entryPoint: primary, hasEsmChanges: true, hasDtsChanges: true }],
165-
esmFiles,
166-
dtsFiles,
167-
options,
168-
);
169-
170-
expect(output.warnings).toEqual([]);
171-
expect(output.filesToEmit).toContain(
172-
jasmine.objectContaining({
173-
path: 'fesm2022/my-lib.mjs',
174-
contents: jasmine.stringContaining('win-ok'),
175-
}),
176-
);
177-
expect(output.filesToEmit).toContain(
178-
jasmine.objectContaining({
179-
path: 'types/my-lib.d.ts',
180-
contents: jasmine.stringContaining('WIN_CONST'),
181-
}),
182-
);
183-
});
184144
});
185145

186146
describe('watch mode shared chunk consistency', () => {

0 commit comments

Comments
 (0)