Skip to content

fix(rollup-plugin): Fix relative paths on Windows env #1573

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions packages/rollup-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
virtualCssFileFilter,
type CompileOptions,
} from '@vanilla-extract/integration';
import { posix } from 'path';
import { posix, sep } from 'path';

const { relative, normalize, dirname } = posix;

Expand Down Expand Up @@ -86,7 +86,7 @@ export function vanillaExtractPlugin({
},
// Replace .css import paths with relative paths to emitted css files
renderChunk(code, chunkInfo) {
const chunkPath = dirname(chunkInfo.fileName);
const chunkPath = dirname(chunkInfo.fileName.replaceAll(sep, posix.sep));
const output = chunkInfo.imports.reduce((codeResult, importPath) => {
const moduleInfo = this.getModuleInfo(importPath);
if (!moduleInfo?.meta.assetId) {
Expand Down