JoshuaCrewe's avatar

Question / Support for Laravel Mix & babel dropping IE 11 support

At this stage I am not sure if I am looking at these tools in the right way. Once upon a time I spent some time making the output of my JS be compiled via babel to support IE 11. Now that we don't need IE11 support any more I'd like to undo this and actually strip out code that is only relevant to older browsers.

I have a .babelrc file in the root :

{
  "presets": [["@babel/preset-env", { "targets": "defaults" }]],
  "plugins": [
    ["transform-react-jsx", {
      "pragma": "wp.element.createElement"
    }]
  ]
}

and a .browserlistrc file next to that :

# Browsers that we support
defaults
not IE 11

I don't have access to IE 11 to really test if this is working or not. What I do know is that the output file size doesn't change whatever I but in that browserlistrc file. I do get an indication that legacy code is being shipping as Page Speed Insights will tell me.

Is it possible with webpack / mix to take all input (node modules and my own code) strip out code only relevant to older browsers and ship code that supports modern browsers? As far as I am able I can't get mix to do anything with node_modules (even with overrides I found on the internet)

If anyone has experience of this process I would be grateful for the chat. Even if it is shoulder shrugs and commiserations.

0 likes
0 replies

Please or to participate in this conversation.