Skip to content

Commit

Permalink
feat(css-to-js): abs vs rel imports
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac committed Jun 19, 2022
1 parent 18e07f8 commit 162c0be
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/css-to-js/css-to-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ exports.transform = (file, processor, opts = {}) => {
if(!imports.size) {
return;
}

const source = options.relativeImports ? `./${path.relative(path.dirname(file), from)}` : from;

const names = [ ...imports ].map(([ key, value ]) => esm(key, value));

out.push(`import { ${names.join(", ")} } from "${slash(from)}";`);
out.push(`import { ${names.join(", ")} } from "${slash(source)}";`);
});

// Add the rest of the exported keys in whatever order because it doesn't matter
Expand Down

0 comments on commit 162c0be

Please sign in to comment.