build: add umd/index.js for es2017+

This commit is contained in:
arthurfiorette 2022-01-13 20:08:29 -03:00
parent 1ccfad3c80
commit 7f3a1538e3
No known key found for this signature in database
GPG Key ID: 9D190CD53C53C555
2 changed files with 7 additions and 5 deletions

View File

@ -9,15 +9,14 @@ const root = (...p) => path.resolve(__dirname, '..', ...p);
/**
* @param {{
* output: string;
* entry: string;
* esTarget: string;
* }} options
* @returns {import('webpack').Configuration}
*/
const config = ({ output, esTarget, entry }) => ({
const config = ({ output, esTarget }) => ({
mode: 'production',
entry: root('src', entry),
entry: root('src', 'index.ts'),
output: {
path: root(),
@ -64,12 +63,14 @@ const config = ({ output, esTarget, entry }) => ({
module.exports = [
config({
esTarget: 'es2015', //es6
entry: 'index.ts',
output: 'umd/es6.min'
}),
config({
esTarget: 'es5',
entry: 'index.ts',
output: 'umd/es5.min'
}),
config({
esTarget: 'es2017',
output: 'umd/index'
})
];

View File

@ -19,6 +19,7 @@ CommonsJS, ESM and more)
- `axios-cache-interceptor/umd/es6.min.js`: Production file for ES6+
- `axios-cache-interceptor/umd/es5.min.js`: Production file for ES5+
- `axios-cache-interceptor/umd/index.js`: Production file for ES2017+
```html
<!-- You can use the cdn of your choice -->