Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : How to exclude modules from build?

$
0
0
There currently isn't a good way of doing this.  However, it will be fairly easy to implement.  Ideally, it should work on the meta config like:


System.meta['jquery] = {bundled: false}

This can work in combination with env and paths.

if(System.env === "production"){
  System.paths['jquery'] = "http://cdn/jquery.js"
} else {
  System.paths['jquery'] = "local/jquery.js"
}


You'll want to write something like:

pluckMatchingMeta(dependencyGraph, {bundled: false});

You'll want to create a pluck_matching_meta here:



something like:

  1. var _ = require("lodash");
  2. module.exports = function(graph, matches){
  3.   var checker = _.createCallback(matches)
  4.   var modules = [];
  5.   for(var moduleName in graph) {
  6.     if( checker(graph[moduleName].load.metadata) ) {
  7.       [].push.apply(modules, pluck(moduleName) )
  8.     }
  9.   }
  10.   return modules;
  11. }


The nice thing is that by removing those modules, when their import comes, System will still try to grab them.  All you have to do is make sure they aren't bundled.



Viewing all articles
Browse latest Browse all 3491

Trending Articles