4

当我使用优化器时,我想忽略使用 require js 插件

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

这总是给我这个错误 Cannot read property 'normalize' of undefined

我已将此选项设置为 require 优化器

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

但它一直给我错误。

4

1 回答 1

0

我不知道这是否是您想要的,但您可以删除 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 优化器配置选项

于 2015-10-07T04:16:18.683 回答