Skip to content

Incorrect work uglify with webpack #1727

@arshtepe

Description

@arshtepe

After minimalization by uglify quotation marks were removed from string
config:

 var webpack = require("webpack");

 module.exports = {
    output: {
        filename:  "dist/index.js"
    },
    context: __dirname,
    entry: "./index.js",
    module: {
        loaders: [
            { test: /\.html/, loaders: ["html-loader"] },
        ]
    },
    plugins: [ new webpack.optimize.UglifyJsPlugin({ }) ]
}

index.js:

console.log( "text: "+ require("./index.html") );

index.html:

<span class="quick-search-shortcut" >
    <i class="icon-loupe" ></i>
</span>

result:

! function (o) {
    function r(e) {
        if (t[e]) return t[e].exports;
        var n = t[e] = {
            exports: {},
            id: e,
            loaded: !1
        };
        return o[e].call(n.exports, n, n.exports, r), n.loaded = !0, n.exports
    }
    var t = {};
    return r.m = o, r.c = t, r.p = "", r(0)
}([function (o, r, t) {
    var e = t(1);
    console.log("text: " + e)
}, function (o, r) {
    o.exports = "<span class=quick-search-shortcut><i class=icon-loupe></i></span>"//removed quotation marks in class attribute
}]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions