According to the documentation (https://cli.vuejs.org/guide/build-targets.html#library), it's not clear to me how to integrate babel to make the lib built be IE11-friendly... I have to make a npm package from a Vue component.
My npm script in package.json is:
vue-cli-service build --target lib src/MyComponent.vue
I've put a correct "browserslist" in package.json.
It seems that I have to use a babel.config.js with a preset.
Not sure of what to install as dev dependencies and what to configure...
Anyone has a working sample lib or some guidance, please?
Answering to myself :-) It was documented but at several places. So...
npm install --save-dev @vue/cli-plugin-babel @babel/preset-env
npm install --save @babel/polyfill current-script-polyfill
import 'current-script-polyfill'
before anything elsebrowserslist
in package.jsonbabel.config.js
with presets: [
['@vue/app']
]
}
Edit : now we use a .browserlistrc
file instead of definition in package.json. Here is what we use, thanks for asking:
> 1%
last 2 versions
not ie < 11