Skip to content

Commit

Permalink
fix: Add subdependency bin directory so wxt build --analyze works w…
Browse files Browse the repository at this point in the history
…ith PNPM (#363)
  • Loading branch information
aklinker1 authored Jan 19, 2024
1 parent 64f4206 commit 9ace395
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"jiti": "^1.21.0",
"json5": "^2.2.3",
"linkedom": "^0.16.1",
"manage-path": "^2.0.0",
"minimatch": "^9.0.3",
"normalize-path": "^3.0.0",
"ora": "^7.0.1",
Expand Down
7 changes: 7 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/core/utils/building/internal-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { printBuildSummary } from '~/core/utils/log';
import glob from 'fast-glob';
import { unnormalizePath } from '~/core/utils/paths';
import { rebuild } from './rebuild';
import managePath from 'manage-path';
import { resolve } from 'node:path';

/**
* Builds the extension based on an internal config. No more config discovery is performed, the
Expand Down Expand Up @@ -75,6 +77,10 @@ async function combineAnalysisStats(config: InternalConfig): Promise<void> {
});
const absolutePaths = unixFiles.map(unnormalizePath);

const alterPath = managePath(process.env);
// Add subdependency path for PNPM shamefully-hoist=false
alterPath.push(resolve(config.root, 'node_modules/wxt/node_modules/.bin'));

await execaCommand(
`rollup-plugin-visualizer ${absolutePaths.join(' ')} --template ${
config.analysis.template
Expand Down
4 changes: 4 additions & 0 deletions src/types/modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ declare module 'web-ext-run/util/logger' {
export const consoleStream: IConsoleStream;
}

declare module 'manage-path' {
export default function managePath(env: object): string[];
}

declare module 'wxt/browser' {
// Overridden when types are generated per project
export type PublicPath = string;
Expand Down

0 comments on commit 9ace395

Please sign in to comment.