I spend a few days to setup a vue.js + vue-cli + typescript + vuetify project to run with IE 11 without success?
I found many posts on the net that explain how it should be done but without success. I tried to combine in almost all the ways possible the setup explained below without success, endind with many different errors up to a blank page
The application runs fine wit Chrome or FF
If someone has such an application running in IE 11 it would be greatly appreciated
Context (all the latest versions):
- vue-cli
- typescript
- vue.js + vue-router + vuex + vuex-persistedstate
- vuetify + vue-i18n + vuelidate
- axios
Pardon me if some question seems stupid as I'm quite a newbie on babel/webpack dev..
What I've tried and questions : (i've tried almost all the combinations the following)
- Should I use
npm install babel-polyfill --saveas explained in the vuetify setup for IE 11 here? - Should I add
import 'babel-polyfill'inmain.tsas explained in the vuetify setup for IE 11 here? - Or should I add
import '@babel/polyfill'inmain.tsas explained here - Should I use
npm install @babel/preset-env --save-devas explained in the vuetify setup for IE 11 here or is it unnecessary due tovue-clibeing used? in
babel.config.js, should I replace the content initially created by vue-clipresets: [ '@vue/app' ]presets: ['@babel/preset-env']or (as seen in many places)?
presets: [['@vue/app', useBuiltIns: 'entry' }]]or add the 2 presets?
presets: [ ['@babel/preset-env'], ['@vue/app', useBuiltIns: 'entry' }] ]Should I add some plugins like explained here?
presets: ['@vue/app'], plugins: ['@babel/transform-modules-commonjs']Or change it like this as explained in the vue doc here?
presets: [ ['@vue/app', { polyfills: [ 'es6.promise', 'es6.symbol' ] }] ]in
vue.config.js, should I add?transpileDependencies: [ 'vuetify', 'vue-i18n', 'vuelidate', 'axios' ]
[SOLUTION 2019-06-25]
We finally got it to work, the answer from @blackening was very helpful
It happened also that we had javsacript errors in IE 11 with google"reCaptcha"that disappeared after the following setup:
As a prerequisite,vue-cliis installed and the project is created by selecting`'Use Babel alongside TypeScript for auto-detected polyfills'
1) installcore-js@3
npm install core-js@3
2) editmain.tslike this:
import 'core-js/stable'
import Vue from 'vue'
import '@/plugins/vuetify'
{...}
3) editbabel.config.js
module.exports = {
presets: [
['@vue/app', { useBuiltIns: 'entry' }]
]
}
And that's it !
Now we are fighting with IE 11 CSS, but that's a know story... As a nexample, invue to apply a style only to IE, just code it like this
<style scoped>
/* Only for IE 11, wrap div text */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.ieMaxWidth90 {
max-width: 90vw; /* 90% view width */
}
}
</style>