settings

rollup and buble

package.json

 {
  "name": "skeleton",
  "version": "1.0.0",
  "author": "",
  "description": "npm module skeleton",
  "main": "index.js",
  "scripts": {
    "start": "npm run watch & npm run server",
    "watch": "rollup -c -w",
    "server": "browser-sync start --files 'build/**, *.html' --server --no-ui --port 8080",
    "build": "rollup -c && uglifyjs build/skeleton.js -cm > build/skeleton.min.js"
  },
  "license": "MIT",
  "devDependencies": {
    "buble": "latest",
    "browser-sync": "latest",
    "rollup": "latest",
    "rollup-watch": "latest",
    "rollup-plugin-buble": "latest",
    "uglify-js": "latest"
  }
}

rollup.config.js

import buble from 'rollup-plugin-buble';

export default {
  entry: 'src/main.js',
  plugins: [
    buble({})
  ],
  targets: [
    {
      moduleName: 'Skeleton',
      dest: 'build/skeleton.js',
      format: 'umd'
    },
    {
      dest: 'build/skeleton.module.js',
      format: 'es'
    }
  ]
};

rollup and bundle other node modules with buble and CommonJS

package.json

 {
  "name": "skeleton",
  "version": "1.0.0",
  "author": "",
  "description": "npm module skeleton",
  "main": "index.js",
  "scripts": {
    "start": "npm run watch & npm run server",
    "watch": "rollup -c -w",
    "server": "browser-sync start --files 'build/**, *.html' --server --no-ui --port 8080",
    "build": "rollup -c && uglifyjs build/skeleton.js -cm > build/skeleton.min.js"
  },
  "license": "MIT",
  "devDependencies": {
    "browser-sync": "latest",
    "buble": "latest",
    "rollup": "latest",
    "rollup-plugin-buble": "latest",
    "rollup-plugin-commonjs": "latest",
    "rollup-plugin-node-resolve": "latest",
    "rollup-watch": "latest",
    "uglify-js": "latest"
  }
}

rollup.config.js

import buble from 'rollup-plugin-buble';
import commonjs from 'rollup-plugin-commonjs';
import resolv from 'rollup-plugin-node-resolve';

export default {
  entry: 'src/main.js',
  indent: '\t',
	plugins: [
		buble(),
		resolv({
			jsnext: true,
			browser: true,
			main: true
		}),
    commonjs({
      include: 'node_modules/**'
    })
	],
  targets: [
    {
			moduleName: 'Test',
      dest: 'build/test.js',
      format: 'umd'
    },
    {
      dest: 'build/test.module.js',
      format: 'es'
    }
  ]
};

rollup and babel

Delete stage-2 if you don't need async/await support.

package.json

 {
  "name": "skeleton",
  "version": "1.0.0",
  "author": "",
  "description": "npm module skeleton",
  "main": "index.js",
  "scripts": {
    "start": "npm run watch & npm run server",
    "watch": "rollup -c -w",
    "server": "browser-sync start --files 'build/**, *.html' --server --no-ui --port 8080",
    "build": "rollup -c && uglifyjs build/skeleton.js -cm > build/skeleton.min.js"
  },
  "license": "MIT",
  "devDependencies": {
    "babel": "latest",
    "rollup": "latest",
    "rollup-watch": "latest",
    "rollup-plugin-babel": "latest",
    "uglify-js": "latest",
    "browser-sync": "latest",
    "babel-preset-es2015-rollup": "latest",
    "babel-preset-stage-2": "latest"
}

rollup.config.js

import babel from 'rollup-plugin-babel';

export default {
  entry: 'src/main.js',
  plugins: [
    babel({
      presets: [ 'es2015-rollup', "stage-2" ]
    })
  ],
  targets: [
    {
      moduleName: 'Skeleton',
      dest: 'build/skeleton.js',
      format: 'umd'
    },
    {
      dest: 'build/skeleton.module.js',
      format: 'es'
    }
  ]
};