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 --save
as explained in the vuetify setup for IE 11 here? - Should I add
import 'babel-polyfill'
inmain.ts
as explained in the vuetify setup for IE 11 here? - Or should I add
import '@babel/polyfill'
inmain.ts
as explained here - Should I use
npm install @babel/preset-env --save-dev
as explained in the vuetify setup for IE 11 here or is it unnecessary due tovue-cli
being used? in
babel.config.js
, should I replace the content initially created by vue-clipresets: [ '@vue/app' ]
by as explained here
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-cli
is 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.ts
like 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>