Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ function getExcludedExtensions() {
return {
'.json': '.json',
'.node': 'node',
/**
* This is a temporary workaround for #246
* See discussion here for full description of the underlying issue
* https://github.com/strongloop/loopback-boot/pull/245#issuecomment-311052798
*/
'.map': 'map',
};
}

Expand Down
22 changes: 22 additions & 0 deletions test/compiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2632,6 +2632,28 @@ describe('compiler', function() {
});
});

it('ignores sourcmap files when loading middleware',
function(done) {
var middleware = appdir.writeFileSync('my-middleware.js',
'// I am the middleware');
var sourcemap = appdir.writeFileSync('my-middleware.js.map',
'// I am a sourcemap');
appdir.writeConfigFileSync('middleware.json', {
'routes': {
'./my-middleware': {},
},
});

boot.compile(appdir.PATH, function(err, context) {
if (err) return done(err);
var instructions = context.instructions;

expect(instructions.middleware.middleware[0]).have.property(
'sourceFile', middleware);
done();
});
});

describe('config with relative paths in params', function() {
var RELATIVE_PATH_PARAMS = [
'$!./here',
Expand Down