Skip to content

Commit

Permalink
fix: issue with entries in server script
Browse files Browse the repository at this point in the history
  • Loading branch information
swashata committed Apr 29, 2021
1 parent 0d6b177 commit 022daa7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
11 changes: 1 addition & 10 deletions packages/scripts/src/config/CreateWebpackConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ export class CreateWebpackConfig {
* @param projectConfig Project configuration as recovered from user directory.
* @param serverConfig Server configuration as recovered from user directory.
* @param isDev Whether this is development mode.
* @param entries Whether to select specified entries from project
*/
constructor(
projectConfig: ProjectConfig,
serverConfig: ServerConfig,
cwd: string,
isDev: boolean = true,
entries?: number[]
isDev: boolean = true
) {
// Create final configuration
// By doing a shallow override
Expand All @@ -56,13 +54,6 @@ export class CreateWebpackConfig {
this.cwd = cwd;
this.isDev = isDev;

// filter project if needed
if (entries && entries.length) {
this.projectConfig.files = this.projectConfig.files.filter((f, index) =>
entries.includes(index)
);
}

// Also figure out the publicPath beforehand, because we do need it
const { slug, outputPath, type } = this.projectConfig;
// The public is generated automatically considering
Expand Down
11 changes: 8 additions & 3 deletions packages/scripts/src/scripts/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ export class Server {
callbacks: Callbacks,
entries?: number[]
) {
this.projectConfig = projectConfig;
this.projectConfig = { ...projectConfig };
// filter project if needed
if (entries && entries.length) {
this.projectConfig.files = this.projectConfig.files.filter((f, index) =>
entries.includes(index)
);
}
this.serverConfig = serverConfig;
this.cwd = cwd;
this.callbacks = callbacks;
Expand All @@ -120,8 +126,7 @@ export class Server {
this.projectConfig,
this.serverConfig,
this.cwd,
true,
entries
true
);
// Check if project has typescript
const [hasTs, tsConfigPath] = hasTypeScript(this.cwd);
Expand Down

0 comments on commit 022daa7

Please sign in to comment.