fix(js): swc exclude config may not a array (#21904)
[swc config is not required](https://swc.rs/docs/configuration/compilation#exclude) ## Current Behavior if not configed `"exclude"` will get a error ```text TypeError: Cannot read properties of undefined (reading 'concat') at generateTmpSwcrc (/Users/hongxu/repos/smallfish/node_modules/@nrwl/js/src/utils/swc/inline.js:7:41) ``` ## Expected Behavior give a default value for swc exclude if nx must need it
This commit is contained in:
parent
e658c16a8f
commit
a8c4e2479b
@ -7,6 +7,11 @@ export function generateTmpSwcrc(
|
|||||||
tmpSwcrcPath: string
|
tmpSwcrcPath: string
|
||||||
) {
|
) {
|
||||||
const swcrc = readJsonFile(swcrcPath);
|
const swcrc = readJsonFile(swcrcPath);
|
||||||
|
swcrc['exclude'] ??= [];
|
||||||
|
|
||||||
|
if (!Array.isArray(swcrc['exclude'])) {
|
||||||
|
swcrc['exclude'] = [swcrc['exclude']];
|
||||||
|
}
|
||||||
|
|
||||||
swcrc['exclude'] = swcrc['exclude'].concat(
|
swcrc['exclude'] = swcrc['exclude'].concat(
|
||||||
Object.values(inlineProjectGraph.externals).map(
|
Object.values(inlineProjectGraph.externals).map(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user