Skip to content

Commit

Permalink
fix: remove file extension from preload webpack entry
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-hyd committed May 11, 2022
1 parent 4c9fa0e commit b23abba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/nx-electron/src/executors/build/executor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join, resolve } from 'path';
import { join, parse, resolve } from 'path';
import { map, tap } from 'rxjs/operators';
import { eachValueFrom } from 'rxjs-for-await';
import { readdirSync } from 'fs';
Expand Down Expand Up @@ -44,7 +44,7 @@ export function executor(rawOptions: BuildElectronBuilderOptions, context: Execu
const projGraph = readCachedProjectGraph();

if (!normalizedOptions.buildLibsFromSource) {
const { target, dependencies } =
const { target, dependencies } =
calculateProjectDependencies(projGraph, context.root, context.projectName, context.targetName, context.configurationName);

normalizedOptions.tsConfig = createTmpTsConfig(normalizedOptions.tsConfig, context.root, target.data.root, dependencies);
Expand All @@ -70,7 +70,7 @@ export function executor(rawOptions: BuildElectronBuilderOptions, context: Execu
const preloadFilesDirectory = join(normalizedOptions.sourceRoot, 'app/api');
readdirSync(preloadFilesDirectory, { withFileTypes: true })
.filter(entry => entry.isFile() && entry.name.match(/(.+[.])?preload.ts/))
.forEach(entry => config.entry[entry.name] = join(preloadFilesDirectory, entry.name));
.forEach(entry => config.entry[parse(entry.name).name] = join(preloadFilesDirectory, entry.name));
} catch (error) {
console.warn('Failed to load preload scripts');
}
Expand Down

0 comments on commit b23abba

Please sign in to comment.