Fixing windows build (#849)

Co-authored-by: Ingvar Stepanyan <rreverser@google.com>
This commit is contained in:
Jake Archibald
2020-11-19 15:03:51 +00:00
committed by GitHub
parent 6ebf94d1b6
commit 30b628c1b9
6 changed files with 15 additions and 17 deletions

View File

@@ -18,6 +18,8 @@ import {
resolve as resolvePath,
dirname,
normalize as nomalizePath,
sep as pathSep,
posix,
} from 'path';
import postcss from 'postcss';
@@ -172,14 +174,15 @@ export default function (resolveFileUrl) {
return `export default ${cssStr};`;
}
if (id.startsWith(addPrefix)) {
const path = id.slice(addPrefix.length);
const path = nomalizePath(id.slice(addPrefix.length));
return (
`import css from 'css:${path}';\n` +
`import css from ${JSON.stringify('css:' + path)};\n` +
`import appendCss from '${appendCssModule}';\n` +
`appendCss(css);\n`
);
}
if (id.endsWith(moduleSuffix)) {
const path = nomalizePath(id.slice(0, -moduleSuffix.length));
if (!pathToResult.has(id)) {
throw Error(`Cannot find ${id} in pathToResult`);
}