Wednesday 31 July 2019

Is there a way to combine Webpack modules to decrease file size?

I'm using CSS modules, so a lot of the modules Webpack generates look like this:

    124: function(t, e, n) {
        t.exports = {
            textarea: "TextareaStyles__textarea"
        }
    },

Then, it's used in React:

return t(r, {
    onInput: o(this, "str"),
    class: a.a.textarea
})

It'll be smaller if Webpack combined the CSS module and React component into a single module. Then, Uglify/Terser can probably just make it inline:

return t(r, {
    onInput: o(this, "str"),
    class: "TextareaStyles__textarea"
})

Is this possible?



from Is there a way to combine Webpack modules to decrease file size?

No comments:

Post a Comment