Skip to content

Commit

Permalink
Path manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Nov 9, 2023
1 parent 7424dfc commit f32e222
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ export const Resources = {
TiledMap: new TiledMapResource('./res/first-level.tmx')
}

// Change the path to be relative to the root directory for the webpack prod build
const convertPath = Resources.TiledMap.convertPath;
Resources.TiledMap.convertPath = (originPath: string, relativePath: string) => {
if (relativePath.indexOf('../') > -1) {
return './' + relativePath.split('../')[1];
}
return convertPath(originPath, relativePath);
}

export const loader = new Loader();
for (let resource of Object.values(Resources)) {
loader.addResource(resource);
Expand Down

0 comments on commit f32e222

Please sign in to comment.