Skip to content

Commit ff49b92

Browse files
committed
Use forked version of webpack-target-webextension for local testing
1 parent 64266a5 commit ff49b92

File tree

1 file changed

+12
-4
lines changed
  • programs/develop/webpack/plugin-extension/feature-scripts/steps/setup-reload-strategy

1 file changed

+12
-4
lines changed

programs/develop/webpack/plugin-extension/feature-scripts/steps/setup-reload-strategy/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as fs from 'fs'
22
import {type Compiler} from '@rspack/core'
3+
import WebExtensionFork from './webpack-target-webextension-fork'
34
import WebExtension from 'webpack-target-webextension'
45
import {filterKeysForThisBrowser} from '../../scripts-lib/manifest'
56
import {SetupBackgroundEntry} from './setup-background-entry'
@@ -76,9 +77,16 @@ export class SetupReloadStrategy {
7677

7778
// 4 - Now that we know the background exists, add the web extension target
7879
// using it. This is our core upstream plugin.
79-
new WebExtension({
80-
background: this.getEntryName(patchedManifest),
81-
weakRuntimeCheck: true
82-
}).apply(compiler as any)
80+
if (process.env.EXTENSION_EXPERIMENTAL_HMR === 'true') {
81+
new WebExtensionFork({
82+
background: this.getEntryName(patchedManifest),
83+
weakRuntimeCheck: true
84+
}).apply(compiler as any)
85+
} else {
86+
new WebExtension({
87+
background: this.getEntryName(patchedManifest),
88+
weakRuntimeCheck: true
89+
}).apply(compiler as any)
90+
}
8391
}
8492
}

0 commit comments

Comments
 (0)