Permalink
Browse files

feat(bundles): support loading assets from node_modules (#358)

  • Loading branch information...
haganbmj authored and Lange committed Dec 25, 2017
1 parent f45eb7a commit 74915d73d4444c36df64fab4652ba6f5b61643c6
Showing with 6 additions and 2 deletions.
  1. +2 −2 lib/graphics/index.js
  2. +4 −0 test/helpers/test-constants.js
View
@@ -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) {
@@ -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`;
},

0 comments on commit 74915d7

Please sign in to comment.