-
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(@ngtools/webpack): JIT mode CommonJS accessing inexistent `defaul…
…t` property With this change we fix an issue in JIT mode were we try to access an inexistent `default` property of styles modules when emitted in CJS. Also, we now emit templates modules without the default property when not targeting ES2015 or greater to normalize the how to `require` templates and styles. Closes #21588 (cherry picked from commit b3f71c5)
- Loading branch information
1 parent
ded7b5c
commit 4d918ef
Showing
4 changed files
with
49 additions
and
10 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
packages/angular_devkit/build_angular/src/builders/karma/tests/behavior/module-cjs_spec.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,31 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import { execute } from '../../index'; | ||
import { BASE_OPTIONS, KARMA_BUILDER_INFO, describeBuilder } from '../setup'; | ||
|
||
describeBuilder(execute, KARMA_BUILDER_INFO, (harness) => { | ||
describe('Behavior: "module commonjs"', () => { | ||
it('should work when module is commonjs', async () => { | ||
harness.useTarget('test', { | ||
...BASE_OPTIONS, | ||
}); | ||
|
||
await harness.modifyFile('src/tsconfig.spec.json', (content) => { | ||
const tsConfig = JSON.parse(content); | ||
tsConfig.compilerOptions.module = 'commonjs'; | ||
|
||
return JSON.stringify(tsConfig); | ||
}); | ||
|
||
const { result } = await harness.executeOnce(); | ||
|
||
expect(result?.success).toBeTrue(); | ||
}); | ||
}); | ||
}); |
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