diff --git a/lib/graphics/index.js b/lib/graphics/index.js index 0aec56379..2fc15d67c 100644 --- a/lib/graphics/index.js +++ b/lib/graphics/index.js @@ -73,7 +73,7 @@ app.get('/bundles/:bundleName/graphics*', ncgUtils.authCheck, (req, res, next) = }); // This isn't really a graphics-specific thing, should probably be in the main server lib. -app.get('/bundles/:bundleName/bower_components/*', (req, res, next) => { +app.get('/bundles/:bundleName/:target(bower_components|node_modules)/*', (req, res, next) => { const bundleName = req.params.bundleName; const bundle = Bundles.find(bundleName); if (!bundle) { @@ -82,7 +82,7 @@ app.get('/bundles/:bundleName/bower_components/*', (req, res, next) => { } const resName = req.params[0]; - const fileLocation = path.join(bundle.dir, 'bower_components', resName); + const fileLocation = path.join(bundle.dir, req.params.target, resName); res.sendFile(fileLocation, err => { if (err) { diff --git a/test/helpers/test-constants.js b/test/helpers/test-constants.js index 67919c1ed..905ff298d 100644 --- a/test/helpers/test-constants.js +++ b/test/helpers/test-constants.js @@ -30,6 +30,10 @@ module.exports = { return `${testBundleRoot()}/bower_components`; }, + get BUNDLE_NODE_MODULES_URL() { + return `${testBundleRoot()}/node_modules`; + }, + get GRAPHIC_URL() { return `${testBundleRoot()}/graphics`; },