2012-11-02 2 views
3

Je voudrais ignorer l'utilisation d'un besoin plugin js lorsque j'utilise l'optimiseuroptimiseur RequireJs IGNORE le plugin

define(["css!styles.css"])

Cela me donne toujours cette erreur Cannot read property 'normalize' of undefined.

J'ai mis cette option à l'optimiseur besoin

{ paths : { 'css' : 'empty:' } }

Mais il ne cesse de me donner l'erreur.

Répondre

0

Je ne sais pas si c'est ce que vous voulez, mais vous pouvez remplacer le plugin css.

//Specify modules to stub out in the optimized file. The optimizer will 
//use the source version of these modules for dependency tracing and for 
//plugin use, but when writing the text into an optimized bundle, these 
//modules will get the following text instead: 
//If the module is used as a plugin: 
// define({load: function(id){throw new Error("Dynamic load not allowed: " + id);}}); 
//If just a plain module: 
// define({}); 
//This is useful particularly for plugins that inline all their resources 
//and use the default module resolution behavior (do *not* implement the 
//normalize() method). In those cases, an AMD loader just needs to know 
//that the module has a definition. These small stubs can be used instead of 
//including the full source for a plugin. 
stubModules: ['text', 'bar'], 

Donc dans votre cas:

stubModules: ['css'] 

Plus de détails, voir Requirejs Optimizer Config options

Questions connexes