Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support minified iife format. #29

Closed
davidnguyen11 opened this issue Feb 5, 2019 · 1 comment
Closed

Add support minified iife format. #29

davidnguyen11 opened this issue Feb 5, 2019 · 1 comment

Comments

@davidnguyen11
Copy link
Contributor

Describe the issue
Add support minified iife format.

Solution

packge.json
Add postbuild command

"scripts": {
    ...,
    "postbuild": "BUILD_MINIFY=true rollup --config"
    ...,
}

rollup.config.js
Install package terser & modify the rollup config.

import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';

const isMinify = process.env.BUILD_MINIFY ? true : false;

let output = [
  {
    file: 'dist/react-paginating.cjs.js',
    name: 'react-paginating-cjs',
    format: 'cjs'
  },
  {
    file: 'dist/react-paginating.esm.js',
    name: 'react-paginating-esm',
    format: 'esm'
  },
  {
    file: 'dist/react-paginating.umd.js',
    name: 'react-paginating-umd',
    format: 'umd',
    sourcemap: true
  },
];

if (isMinify) {
  output = {
    file: 'dist/react-paginating.umd.min.js',
    name: 'react-paginating.umd.min',
    format: 'iife',
    sourcemap: true
  };
}

export default [{
  input: 'src/Pagination/index.js',
  output,
  plugins: [
    babel({
      exclude: 'node_modules/**'
    }),
    isMinify ? terser() : null
  ]
}];
@davidnguyen11
Copy link
Contributor Author

released at version 1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant