Skip to content

Commit

Permalink
feat: iife for small bundle
Browse files Browse the repository at this point in the history
BEAKING CHANGE:
pkg.browser now use iife bundle
bundles structure dir changed to `dist/format/file.js` except for iife `dist/file.js`
  • Loading branch information
ekoeryanto committed Oct 12, 2018
1 parent 2bb90ba commit 0b37032
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "material-design-icon-list",
"version": "3.2.1-nightly.6",
"description": "A list Google's Material Design Icons",
"main": "dist/list.cjs.js",
"module": "dist/list.esm.js",
"main": "dist/cjs/list.js",
"module": "dist/esm/list.js",
"browser": "dist/list.js",
"author": "Eko Eryanto",
"license": "MIT",
Expand Down
23 changes: 11 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import json from 'rollup-plugin-json';
import { resolve } from 'path'

const plugins = [json()];

const files = ['categories', 'icons', 'ids', 'index', 'list'];
const formats = ['umd', 'cjs', 'esm'];
const formats = ['umd', 'cjs', 'esm', 'iife'];

const createOutput = ({format, file}) => {
if (format === 'umd') {
return {
format,
file: `dist/${file}.js`,
name: 'window',
extend: true
};
}
return {
let output = {
format,
file: `dist/${file}.${format}.js`
};
file: resolve('dist', format === 'iife' ? '' : format, `${file}.js`)
}

if (format === 'umd' || format === 'iife') {
output.name = 'materialDesignIconList'
}

return output
};

export default files.map(file => {
Expand Down

0 comments on commit 0b37032

Please sign in to comment.