Skip to content

Commit

Permalink
refactor: make platform optional in DevelopmentPlugin (#989)
Browse files Browse the repository at this point in the history
* refactor: make platform optional in development plugin

* chore: changeset
  • Loading branch information
jbroma authored Feb 13, 2025
1 parent de82bbf commit 88474ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-ants-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@callstack/repack": patch
---

Make `platform` option of DevelopmentPlugin optional
7 changes: 5 additions & 2 deletions packages/repack/src/plugins/DevelopmentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ type PackageJSON = { version: string };
* {@link DevelopmentPlugin} configuration options.
*/
export interface DevelopmentPluginConfig {
platform: string;
/**
* Target application platform.
*/
platform?: string;
}

/**
Expand Down Expand Up @@ -103,7 +106,7 @@ export class DevelopmentPlugin implements RspackPluginInstance {
const host = compiler.options.devServer.host;
const port = compiler.options.devServer.port;
const protocol = this.getProtocolType(compiler.options.devServer);
const platform = this.config.platform;
const platform = this.config.platform ?? (compiler.options.name as string);

new compiler.webpack.DefinePlugin({
__PLATFORM__: JSON.stringify(platform),
Expand Down

0 comments on commit 88474ea

Please sign in to comment.