Skip to content

Commit

Permalink
fix: rewrite package.main (index.js) imports in postpackage script
Browse files Browse the repository at this point in the history
  • Loading branch information
6eDesign committed Sep 17, 2021
1 parent 113698a commit 8374348
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/postpackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ const transformFolder = async ({ folders, files, depth }) => {
const filepath = path.join(CWD, f);
const contents = await fs.readFile(filepath, 'utf-8');
const base = depth ? [...Array(depth + 1).fill('..')].join('/') : './';
const updated = contents.replace(/from '\$lib(.*)'/g, `from '${base}$1'`);
const updated = contents
.replace(/from '\$lib(.*)'/g, `from '${base}$1'`)
.replace(/src\/lib\//g, '');
await Promise.all(
[
updated === contents ? null : fs.writeFile(filepath, updated),
Expand Down

0 comments on commit 8374348

Please sign in to comment.