Fix icons glob: pre-copy icons and patch webpack CopyPlugin
mkYarnPackage symlinks node_modules into the read-only Nix store, so we can't modify the directory in-place. Instead, pre-copy the @grafana/ui icons to the webpack output location and sed-remove the CopyPlugin entry that tries to glob through the symlink. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1327972183
commit
98bff9e3eb
1 changed files with 11 additions and 7 deletions
|
|
@ -27,14 +27,18 @@ let
|
|||
export HOME=$TMPDIR
|
||||
cd deps/grafana-pyroscope
|
||||
|
||||
# Dereference @grafana/ui icons so webpack CopyPlugin glob can find them
|
||||
# mkYarnPackage symlinks node_modules into the Nix store (read-only).
|
||||
# Webpack CopyPlugin can't glob through these symlinks to find
|
||||
# @grafana/ui icons. Pre-copy them to the output location and patch
|
||||
# webpack to skip the CopyPlugin entry for icons.
|
||||
icons_src="node_modules/@grafana/ui/dist/public/img/icons"
|
||||
if [ -L "$icons_src" ] || [ -d "$icons_src" ]; then
|
||||
icons_tmp=$(mktemp -d)
|
||||
cp -rL "$icons_src" "$icons_tmp/"
|
||||
rm -rf "$icons_src"
|
||||
cp -r "$icons_tmp/icons" "$icons_src"
|
||||
fi
|
||||
mkdir -p public/build/grafana/build/img/icons
|
||||
cp -rL "$icons_src"/* public/build/grafana/build/img/icons/
|
||||
|
||||
# Remove the CopyPlugin icons entry from webpack config so it doesn't
|
||||
# fail on the symlinked glob
|
||||
sed -i "/from: 'node_modules\/@grafana\/ui\/dist\/public\/img\/icons'/,/to:/d" \
|
||||
scripts/webpack/webpack.common.js
|
||||
|
||||
yarn --offline build
|
||||
runHook postBuild
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue