Skip to content

Commit

Permalink
Use consistent separator on windows
Browse files Browse the repository at this point in the history
When an addon does app.import of a file out of node_modules, the path we use to refer to that file had a mix of different path separators. That doesn't actually break, but the inconsistency made it hard to test and our test suite revealed the problem (in #1246).
  • Loading branch information
ef4 committed Aug 17, 2022
1 parent 0d5a072 commit 0aad0c7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/compat/src/v1-app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Memoize } from 'typescript-memoize';
import { sync as pkgUpSync } from 'pkg-up';
import { join, dirname, isAbsolute } from 'path';
import { join, dirname, isAbsolute, sep } from 'path';
import buildFunnel from 'broccoli-funnel';
import mergeTrees from 'broccoli-merge-trees';
import { WatchedDir } from 'broccoli-source';
Expand Down Expand Up @@ -321,7 +321,7 @@ export default class V1App {
// `app.import('node_modules/something/...')`, so we go find its answer.
for (let { name, path } of this.app._nodeModules.values()) {
if (match[1] === name) {
return filename.replace(match[0], path + '/');
return filename.replace(match[0], path + sep);
}
}
throw new Error(`bug: expected ember-cli to already have a resolved path for asset ${filename}`);
Expand Down

0 comments on commit 0aad0c7

Please sign in to comment.