mirror of https://github.com/status-im/metro.git
Fix importing a dot file from the root directory doesn't work
Summary: Hi, **Summary** This fixes #40 where bundler cannot resolve a file starting with `.` from the root package directory. it just adds a check to see if the absolute path filename is the same as the localpath filename then lets it through. **Test plan** - Steps to reproduce have been written up in #40 Thanks! Closes https://github.com/facebook/metro-bundler/pull/54 Reviewed By: cpojer Differential Revision: D5974618 Pulled By: mjesun fbshipit-source-id: 4b7113c3bed20f2c908739881d61410d651e6ed7
This commit is contained in:
parent
d07bfa1532
commit
6c60f61cbd
|
@ -12,7 +12,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const {relative} = require('path');
|
||||
const {relative, basename} = require('path');
|
||||
|
||||
declare class OpaqueLocalPath {}
|
||||
export type LocalPath = OpaqueLocalPath & string;
|
||||
|
@ -25,7 +25,7 @@ function toLocalPath(
|
|||
): LocalPath {
|
||||
for (let i = 0; i < roots.length; i++) {
|
||||
const localPath = relative(roots[i], absolutePath);
|
||||
if (localPath[0] !== '.') {
|
||||
if (localPath[0] !== '.' || basename(absolutePath) == localPath) {
|
||||
return (localPath: any);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue