クライアント側のヒスイテンプレートを使用するクライアントスクリプトを最適化しようとすると問題が発生します。最初は、Require.js +バックボーンの最適化で説明されているエラーが発生しましたが、パス構成から「text」モジュールを削除し、excludesに追加して、text.jsをローカルで使用できるようにしました。その後、オプトマイザーがテキストモジュールに渡されているパラメーターを解決しようとするとエラーが発生します。
これが私のクライアントサイドテンプレートです:
define([
'Handlebars',
'text!/templates/product/something.jade'
], function(Handlebars, txtSomething) {
var template = Handlebars.template,
templates = Handlebars.templates = Handlebars.templates || {};
templates['something'] = Handlebars.compile(txtSomething);
});
そして、オプティマイザー構成:
({
baseUrl: ".",
name: "product",
out: "product.js",
paths: {
Handlebars: "empty:"
},
exclude: ["text"]
})
そして、私が得るエラー:
Error: ENOENT, no such file or directory 'C:\templates\product\something.jade'
In module tree:
product
modules/something
templates/something
text
問題を解決する方法について何かアドバイスはありますか?