Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asset path issue for "compound-design-tokens" package #26646

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ function getAssetOutputPath(url, resourcePath) {
const isKaTeX = resourcePath.includes("KaTeX");
// `res` is the parent dir for our own assets in various layers
// `dist` is the parent dir for KaTeX assets
const prefix = /^.*[/\\](dist|res)[/\\]/;
const prefix = /^.*[/\\](dist|res|compound-design-tokens)[/\\]/;

/**
* Only needed for https://github.com/vector-im/element-web/pull/15939
Expand All @@ -819,20 +819,6 @@ function getAssetOutputPath(url, resourcePath) {
}
let outputDir = path.dirname(resourcePath).replace(prefix, "");

/**
* Imports from Compound are "absolute", we need to strip out the prefix
* coming before the npm package name.
*
* This logic is scoped to compound packages for now as they are the only
* package that imports external assets. This might need to be made more
* generic in the future
*/
const compoundImportsPrefix = /@vector-im(?:\\|\/)compound-(.*?)(?:\\|\/)/;
const compoundMatch = outputDir.match(compoundImportsPrefix);
if (compoundMatch) {
outputDir = outputDir.substring(compoundMatch.index + compoundMatch[0].length);
}

if (isKaTeX) {
// Add a clearly named directory segment, rather than leaving the KaTeX
// assets loose in each asset type directory.
Expand Down