Skip to content

Commit

Permalink
Update packages/kit/src/core/sync/copy_assets.js
Browse files Browse the repository at this point in the history
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
  • Loading branch information
Rich-Harris and benmccann authored Mar 3, 2022
1 parent 30f7803 commit 800476b
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions packages/kit/src/core/sync/copy_assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@ const __dirname = path.dirname(__filename);

/** @param {string} dest */
export function copy_assets(dest) {
if (process.env.BUNDLED) {
let prefix = '..';
do {
// we jump through these hoops so that this function
// works whether or not it's been bundled
const resolved = path.resolve(__dirname, `${prefix}/assets`);
if (!process.env.BUNDLED) return;
let prefix = '..';
do {
// we jump through these hoops so that this function
// works whether or not it's been bundled
const resolved = path.resolve(__dirname, `${prefix}/assets`);

if (fs.existsSync(resolved)) {
copy(resolved, dest);
return;
}
if (fs.existsSync(resolved)) {
copy(resolved, dest);
return;
}

prefix = `../${prefix}`;
} while (true); // eslint-disable-line
}
prefix = `../${prefix}`;
} while (true); // eslint-disable-line
}

0 comments on commit 800476b

Please sign in to comment.