Оптимизатор RequireJs игнорирует плагин

Я хотел бы игнорировать использование плагина require js при использовании оптимизатора

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

Это всегда дает мне эту ошибку Cannot read property 'normalize' of undefined.

Я установил для этих параметров требуемый оптимизатор

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

Но он продолжает выдавать мне ошибку.


person Yacine Zalouani    schedule 02.11.2012    source источник
comment
Есть новости по этому поводу? Вы нашли ответ?   -  person Mario Murrent    schedule 27.06.2018


Ответы (1)


Я не знаю, хотите ли вы этого, но вы можете отключить плагин 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'],

Итак, в вашем случае:

stubModules: ['css']

Дополнительные сведения см. в разделе параметры конфигурации Requirejs Optimizer.

person asgoth    schedule 07.10.2015