Skip to content

Commit 4754d8f

Browse files
committed
fixup! fix(@angular/build): support quotes in styles and polyfills paths
1 parent 0b3cf8a commit 4754d8f

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

‎packages/angular/build/src/builders/application/tests/options/polyfills_spec.ts‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,6 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
6161
harness.expectFile('dist/browser/polyfills.js').content.toContain(`console.log("main")`);
6262
});
6363

64-
it('uses a provided file with a single quote in its path', async () => {
65-
await harness.writeFile(`src/dev's polyfills/polyfills.js`, `console.log('main');`);
66-
67-
harness.useTarget('build', {
68-
...BASE_OPTIONS,
69-
polyfills: [`src/dev's polyfills/polyfills.js`],
70-
});
71-
72-
const { result } = await harness.executeOnce();
73-
74-
expect(result?.success).toBe(true);
75-
76-
harness.expectFile('dist/browser/polyfills.js').content.toContain(`console.log("main")`);
77-
});
78-
7964
it('fails and shows an error when file does not exist', async () => {
8065
harness.useTarget('build', {
8166
...BASE_OPTIONS,
@@ -104,5 +89,21 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
10489
});
10590
});
10691
}
92+
93+
it('uses a provided file with a single quote in its path', async () => {
94+
await harness.writeFile('src/main.ts', 'console.log("TEST");');
95+
await harness.writeFile(`src/dev's polyfills/polyfills.js`, `console.log('main');`);
96+
97+
harness.useTarget('build', {
98+
...BASE_OPTIONS,
99+
polyfills: [`src/dev's polyfills/polyfills.js`],
100+
});
101+
102+
const { result } = await harness.executeOnce();
103+
104+
expect(result?.success).toBe(true);
105+
106+
harness.expectFile('dist/browser/polyfills.js').content.toContain(`console.log("main")`);
107+
});
107108
});
108109
});

‎packages/angular/build/src/tools/esbuild/application-code-bundle.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ export function createServerMainCodeBundleOptions(
364364
`export { ɵresetCompiledComponents } from '@angular/core';`,
365365

366366
// Re-export all symbols including default export from 'main.server.ts'
367-
`export { default } from '${mainServerEntryPointJsImport}';`,
368-
`export * from '${mainServerEntryPointJsImport}';`,
367+
`export { default } from ${JSON.stringify(mainServerEntryPointJsImport)};`,
368+
`export * from ${JSON.stringify(mainServerEntryPointJsImport)};`,
369369
];
370370

371371
return {
@@ -496,8 +496,8 @@ export function createSsrEntryCodeBundleOptions(
496496
`import '${ssrInjectManifestNamespace}';`,
497497

498498
// Re-export all symbols including default export
499-
`import * as server from '${serverEntryPointJsImport}';`,
500-
`export * from '${serverEntryPointJsImport}';`,
499+
`import * as server from ${JSON.stringify(serverEntryPointJsImport)};`,
500+
`export * from ${JSON.stringify(serverEntryPointJsImport)};`,
501501
// The below is needed to avoid
502502
// `Import "default" will always be undefined because there is no matching export` warning when no default is present.
503503
`const defaultExportName = 'default';`,

0 commit comments

Comments
 (0)