Skip to content

Commit

Permalink
fix(plugin-garfish): only override assetPrefix default value (#4725)
Browse files Browse the repository at this point in the history
* fix(plugin-garfish): only override assetPrefix default value

* fix: test
  • Loading branch information
chenjiahan authored Sep 26, 2023
1 parent 9ab3eb0 commit b05b24b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/red-hairs-knock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/plugin-garfish': patch
---

fix(plugin-garfish): only override assetPrefix default value

fix(plugin-garfish): 只对 assetPrefix 的默认值进行覆盖
13 changes: 12 additions & 1 deletion packages/runtime/plugin-garfish/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,19 @@ export const garfishPlugin = ({
const resolveOptions = useResolvedConfigContext();
if (resolveOptions?.deploy?.microFrontend) {
chain.output.libraryTarget('umd');
if (

const DEFAULT_ASSET_PREFIX = '/';

// Only override assetPrefix when using the default asset prefix,
// this allows user or other plugins to set asset prefix.
const resolvedAssetPrefix = resolveOptions.dev?.assetPrefix;
const isUsingDefaultAssetPrefix =
!useConfig.dev?.assetPrefix &&
(!resolvedAssetPrefix ||
resolvedAssetPrefix === DEFAULT_ASSET_PREFIX);

if (
isUsingDefaultAssetPrefix &&
resolveOptions?.server?.port &&
env === 'development'
) {
Expand Down

0 comments on commit b05b24b

Please sign in to comment.