模块导出时,JS缩小不起作用

时间:2020-06-04 14:12:27

标签: javascript jquery asp.net-mvc bundling-and-minification bundles

缩小js文件时确实出现以下错误

/* Minification failed. Returning unminified contents.
(36307,7-8): run-time error JS1010: Expected identifier: .
(36307,7-8): run-time error JS1195: Expected expression: .
(36817,7-8): run-time error JS1010: Expected identifier: .
(36817,7-8): run-time error JS1195: Expected expression: .
(36820,7-8): run-time error JS1010: Expected identifier: .
(36820,7-8): run-time error JS1195: Expected expression: .
 */

下面的JavaScript文件脚本文件, 但是我发现包含“ module.export”的JavaScript 不会被缩小,我也使用 在线工具 用于缩小,但是缩小的文件不包含“ module.export” 它被删除 在缩小过程中。任何有关如何排序JavaScript文件缩小问题的帮助都包含module.export

(function e(t, n, r) {

    module.exports = FilterCSS;

}, {
    "./default": 7,
    "./parser": 9,
    "./util": 10
}], 7: [function(require, module, exports) {
        /**
         * cssfilter
         *
         * @author ??<leizongmin@gmail.com>
         */

        function getDefaultWhiteList() {
            // ??????:
            // true: ?????
            // Function: function (val) { } ??true???????,?????????
            // RegExp: regexp.test(val) ??true???????,?????????
            // ??????????????
            var whiteList = {};

            whiteList['align-content'] = false; // default: auto
            whiteList['align-items'] = false; // default: auto

            *
            *
            @param {
                String
            }
            name
                *
                @param {
                    String
                }
            value
                *
                @param {
                    Object
                }
            options
                *
                @return {
                    String
                }
                */

            function onAttr(name, value, options) {
                // do nothing
            }

            /**
             * ???????????????
             *
             * @param {String} name
             * @param {String} value
             * @param {Object} options
             * @return {String}
             */
            function onIgnoreAttr(name, value, options) {
                // do nothing
            }

            var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img;

            /**
             * ?????
             *
             * @param {String} name
             * @param {String} value
             * @return {String}
             */
            function safeAttrValue(name, value) {
                if (REGEXP_URL_JAVASCRIPT.test(value)) return '';
                return value;
            }


            exports.whiteList = getDefaultWhiteList();
            exports.getDefaultWhiteList = getDefaultWhiteList;
            exports.onAttr = onAttr;
            exports.onIgnoreAttr = onIgnoreAttr;
            exports.safeAttrValue = safeAttrValue;

        }, {}], 8: [function(require, module, exports) {
        /**
         * cssfilter
         *
         * @author ??<leizongmin@gmail.com>
         */

        var DEFAULT = require('./default');
        var FilterCSS = require('./css');


        /**
         * XSS??
         *
         * @param {String} css ????CSS??
         * @param {Object} options ??:whiteList, onAttr, onIgnoreAttr
         * @return {String}
         */
        function filterCSS(html, options) {
            var xss = new FilterCSS(options);
            return xss.process(html);
        }


        // ??
        exports = module.exports = filterCSS;
        exports.FilterCSS = FilterCSS;
        for (var i in DEFAULT) exports[i] = DEFAULT[i];

        // ???????
        if (typeof window !== 'undefined') {
            window.filterCSS = module.exports;
        }

    }, {
        "./css": 6,
        "./default": 7
    }], 9: [function(require, module, exports) {
            /**
             * cssfilter
             *
             * @author ??<leizongmin@gmail.com>
             */

            var _ = require('./util');

0 个答案:

没有答案