如何从生成中排除.js.map



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

.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
            }
        }
    }
}();

首先,问题中使用的"exclude"一词不太准确。这些文件是由编译系统生成的,它们不是源中存在的要首先排除的文件。

如果不希望生成源映射,请在生成配置文件中设置useSourceMaps: false

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

通常包含这两个文件的原因是为了帮助调试已构建的应用程序。在正常使用过程中,浏览器不会下载这两个文件;它们将仅由开发人员工具请求。

"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

最新更新