Skip to content

Instantly share code, notes, and snippets.

@satishbabariya
Created May 28, 2020 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satishbabariya/68a903a06e72acd2f3352af0df8ef760 to your computer and use it in GitHub Desktop.
Save satishbabariya/68a903a06e72acd2f3352af0df8ef760 to your computer and use it in GitHub Desktop.
Rollup babel setup

Rollup

Rollup represents another recent addition and alternative. Users who've used webpack will find Rollup's configuration familiar and easy to set up:

We add the following Rollup dependencies:

    "rollup": "=0.58.2",
    "rollup-plugin-babel": "=3.0.4",
    "rollup-plugin-uglify": "=3.0.0"

For Development:

$ rollup -c rollup/rollup.dev.config.js --external all
import babel from 'rollup-plugin-babel';

export default {
  entry: 'reactAppSrc/rollup.index.js',
  dest: 'public/built/main.min.js',
  format: 'iife',
  plugins: [
    babel({
      babelrc: false,
      exclude: 'node_modules/**',
      presets: [
        "react",

        [
          "es2015",
          {
            "modules": false
          }
        ]
      ],
      "plugins": [
        "external-helpers"
      ]
    })
  ],
};

For Production:

$ rollup -c rollup/rollup.prod.config.js --external all
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify'

export default {
  entry: 'reactAppSrc/rollup.index.js',
  dest: 'public/built/main.min.js',
  format: 'iife',
  sourceMap: 'inline',
  plugins: [
    babel({
      babelrc: false,
      exclude: 'node_modules/**',
      presets: [
        "react",

        [
          "es2015",
          {
            "modules": false
          }
        ]
      ],
      "plugins": [
        "external-helpers"
      ]
    }),
    uglify()
  ],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment