1

我需要从我的构建文件中排除结尾/包含

.js.map  

.js.uncompressed.js

我正在尝试使用一些regex没有成功

        ignore: function(t) {
            return /\.js.map$/.test(t)
        },
        miniExclude: function(t) {
            return /\.js.map$/.test(t)
        }

我正在使用 DOJO 1.10。

我在这里做错了什么?


var profile = function() {
    return {
        basePath: "../",
        releaseDir: "dist",
        releaseName: "build",
        optimize: "closure",
        action: "release",
        layerOptimize: "closure",
        copyTests: !1,
        stripConsole: "all",
        version: "ntv-0.0.0",
        cssOptimize: "comments",
        mini: !0,
        staticHasFeatures: {
            "dojo-trace-api": !1,
            "dojo-log-api": !1,
            "dojo-publish-privates": !1,
            "dojo-sync-loader": !1,
            "dojo-xhr-factory": !1,
            "dojo-test-sniff": !1
        },
        resourceTags: {
            amd: function(t) {
                return /\.js$/.test(t)
            },
            ignore: function(t) {
                return /\.js.map$/.test(t)
            },
            miniExclude: function(t) {
                return /\.js.map$/.test(t)
            }
        },
        packages: [{
            name: "dojo",
            location: "dojo"
        }, {
            name: "test",
            location: "test"
        }],
        layers: {
            "dojo/dojo": {
                include: ["dojo/dojo"],
                customBase: !0,
                boot: !0
            },
            "test/c": {
                include: ["test/c/c"],
                customBase: !0,
                boot: !1
            },
            "test/b": {
                include: ["test/b/b"],
                customBase: !0,
                boot: !1
            },
            "test/a": {
                include: ["test/a/a"],
                customBase: !0,
                boot: !1
            }
        }
    }
}();
4

2 回答 2

1

首先,问题中使用的“排除”一词并不十分准确。这些是构建系统生成的文件 - 它们不是存在于源中的文件,首先要排除在外。

如果您不希望构建生成源映射,useSourceMaps: false请在构建配置文件中进行设置。

至于*.uncompressed.js文件,构建会自动为它缩小的任何模块或层生成这些文件。如果您真的不希望它们出现在构建输出中,则需要在之后使用评论中建议的 frank 之类的命令将它们删除。

通常包含这两个文件的原因是为了帮助调试已构建的应用程序。在正常使用期间,浏览器不会下载这些文件;它们只会被开发者工具请求。

于 2015-02-18T02:46:49.130 回答
0
"asd.js.uncompressed.js".match(/.{1,}\.(js\.map|js\.uncompressed\.js)$/g) //match
"khaslkda.js.map".match(/.{1,}\.(js\.map|js\.uncompressed\.js)$/g) //match
"khaslkda.map".match(/.{1,}\.(js\.map|js\.uncompressed\.js)$/g) // no match
"khaslkda.map.js".match(/.{1,}\.(js\.map|js\.uncompressed\.js)$/g) //no match

我真的不知道道场。但是这个正则表达式可能对你有帮助吗?

编辑:我使用了匹配..但它也应该与测试一起使用。就这样做

/.{1,}\.(js\.map|js\.uncompressed\.js)$/g.test("as-_d.js.uncompressed.js") //true
于 2015-02-17T15:15:35.733 回答