如何在browserify中使用此模块

时间:2015-09-28 14:06:51

标签: javascript node.js browserify kraken.js

我有一个由grunt进程生成的模块:

require = (function e(t, n, r) {
    function s(o, u) {
        if (!n[o]) {
            if (!t[o]) {
                var a = typeof require == "function" && require;
                if (!u && a) return a(o, !0);
                if (i) return i(o, !0);
                var f = new Error("Cannot find module '" + o + "'");
                throw f.code = "MODULE_NOT_FOUND", f
            }
            var l = n[o] = {
                exports: {}
            };
            t[o][0].call(l.exports, function(e) {
                var n = t[o][1][e];
                return s(n ? n : e)
            }, l, l.exports, e, t, n, r)
        }
        return n[o].exports
    }
    var i = typeof require == "function" && require;
    for (var o = 0; o < r.length; o++) s(r[o]);
    return s
})({
    "_languagepack": [function(require, module, exports) {
        module.exports = {
            "en-US": {
                "errors/404.properties": {
                    "header": "File not found",
                    "description": "The URL <code>{url}</code> did not resolve to a route."
                },
                "errors/500.properties": {
                    "header": "Internal server error",
                    "description": "The URL <code>{url}</code> had the following error <code>{err}</code>."
                },
                "errors/503.properties": {
                    "header": "Service unavailable",
                    "description": "The service is unavailable. Please try back shortly."
                },
                "index.properties": {
                    "greeting": "Hello, {name}!"
                },
                "layouts/master.properties": {
                    "greeting": "Hello, {name}!"
                },
                "partial-usecontent.properties": {
                    "greeting": "Usecontent, {name}!"
                },
                "partial.properties": {
                    "greeting": "Partial, {name}!"
                }
            }
        }
    }, {}]
}, {}, []);

此模块应用于访问本地化内容,此文件特定于区域设置&#34; en-US&#34;。我应该如何使用browserify访问对象&#34; errors / 404.properties&#34;

我尝试将模块设为var enUS= require(../module.js),但这会导致空对象{}

0 个答案:

没有答案