Does anyone have v4 working with IE11? #1605
-
❓QuestionI upgraded to v4 recently and my build output is full of The package.json browserslist key explicitly references IE11 (of course I would like to drop support...). I added a .babelrc file like so: {
"presets": [
[
"razzle/babel",
{
"preset-env": {
"targets": {
"ie": "11"
},
"debug": true
}
}
]
],
"plugins": []
} and I can see from the debug output that babel is picking up IE as a target:
I would have expected this to be enough to force transpilation to ES5, but with the addition of babel-preset-razzle I'm not really sure what's going on. The first lamda expression that comes up is from babel itself, a helper for Object.defineProperty. Does anyone have any experience with this, or have a better idea how this should work? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 6 replies
-
https://razzlejs.org/docs/customization#options - browserslist |
Beta Was this translation helpful? Give feedback.
-
not sure about targets in preset-env |
Beta Was this translation helpful? Give feedback.
-
are you using typescript? if so you may need to import polyfills before the actual entrypoint https://github.com/jaredpalmer/razzle/blob/master/examples/with-webpack-public-path/src/client.js |
Beta Was this translation helpful? Give feedback.
-
Thanks @fivethreeo for suggestions. Polyfills !== transpilation, e.g. this won't help IE 11 to parse arrow functions, const etc. As far as I'm aware polyfills are being loaded okay. I already had browserslist set up and this includes There's something else weird going on. I tried separating the client entry point into two files as suggested but nothing seems to make any difference. I should start a fresh project and see if I can reproduce the problem, but of course this is time no one is giving me today. |
Beta Was this translation helpful? Give feedback.
-
I think you may need to add the external modules with arrow functions to include in babelrule. Added docs now: https://razzlejs.org/docs/customization#transpilation-of-external-modules |
Beta Was this translation helpful? Give feedback.
-
To see the actual code you can try: //./razzle.config.js
'use strict';
module.exports = {
modifyWebpackConfig({
webpackConfig,
}) {
webpackConfig.optimization.minimize = false
webpackConfig.optimization.minimizer = []
return webpackConfig;
}
}; |
Beta Was this translation helpful? Give feedback.
I think you may need to add the external modules with arrow functions to include in babelrule.
Added docs now: https://razzlejs.org/docs/customization#transpilation-of-external-modules