Skip to content

Commit

Permalink
Fix for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
brijeshb42 committed Apr 8, 2024
1 parent dc6ed93 commit 74d2fff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"benchmark:browser": "pnpm --filter benchmark browser",
"build": "lerna run build --ignore docs",
"build:public": "lerna run --no-private build",
"build:ci": "lerna run build --ignore docs --concurrency 7 --skip-nx-cache",
"build:ci": "lerna run build --ignore docs --concurrency 8 --skip-nx-cache",
"build:zero": "lerna run --scope \"@pigmentcss/*\" build",
"clean:zero": "pnpm --filter \"@pigmentcss/*\" clean",
"build:codesandbox": "NODE_OPTIONS=\"--max_old_space_size=4096\" lerna run --concurrency 8 --scope \"@mui/*\" --scope \"@mui-internal/*\" --no-private build",
Expand Down
7 changes: 5 additions & 2 deletions packages/pigment-css-unplugin/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// import * as path from 'node:path';
import * as path from 'node:path';

export type AsyncResolver = (what: string, importer: string, stack: string[]) => Promise<string>;

Expand Down Expand Up @@ -39,9 +39,12 @@ export const handleUrlReplacement = async (
if (!resolvedAbsolutePath) {
newCss += `url(${mainItem})`;
} else {
let pathFromRoot = resolvedAbsolutePath.replace(projectPath, '');
// Need to do this for Windows paths
pathFromRoot = pathFromRoot.split(path.sep).join('/');
// const relativePathToProjectRoot = path.relative()
// Next.js expects the path to be relative to the project root and starting with ~
newCss += `url(~${resolvedAbsolutePath.replace(projectPath, '')})`;
newCss += `url(~${pathFromRoot})`;
}
}
lastIndex = match.index + match[0].length;
Expand Down

0 comments on commit 74d2fff

Please sign in to comment.