Resolve missing file extension for module relative paths
This commit is contained in:
parent
c9f377a4c9
commit
187a105333
|
@ -312,7 +312,13 @@ function resolveAppPath(rootDir, relativePath) {
|
|||
|
||||
fullPath = modulePaths
|
||||
.map(function(candidateDir) {
|
||||
return path.join(candidateDir, relativePath);
|
||||
try {
|
||||
var filePath = path.join(candidateDir, relativePath);
|
||||
filePath = require.resolve(filePath);
|
||||
return filePath;
|
||||
} catch (err) {
|
||||
return filePath;
|
||||
}
|
||||
})
|
||||
.filter(function(candidate) {
|
||||
return fs.existsSync(candidate);
|
||||
|
|
|
@ -469,6 +469,18 @@ describe('compiler', function() {
|
|||
expect(instructions.files.boot).to.eql([initJs]);
|
||||
});
|
||||
|
||||
it('resolves missing extensions in `bootScripts` in module relative path',
|
||||
function() {
|
||||
appdir.createConfigFilesSync();
|
||||
var initJs = appdir.writeFileSync('node_modules/custom-boot/init.js', '');
|
||||
|
||||
var instructions = boot.compile({
|
||||
appRootDir: appdir.PATH,
|
||||
bootScripts: ['custom-boot/init']
|
||||
});
|
||||
expect(instructions.files.boot).to.eql([initJs]);
|
||||
});
|
||||
|
||||
it('ignores index.js in `bootDirs`', function() {
|
||||
appdir.createConfigFilesSync();
|
||||
appdir.writeFileSync('custom-boot/index.js', '');
|
||||
|
|
Loading…
Reference in New Issue