How to use rollup-plugin-uglify - 10 common examples

To help you get started, we’ve selected a few rollup-plugin-uglify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / arcgis-rest-js / umd-production-profile.js View on Github external
import config from './umd-base-profile.js';
import { uglify } from "rollup-plugin-uglify";
import filesize from "rollup-plugin-filesize";

// use umd.min.js
config.output.file = config.output.file.replace(".umd.", ".umd.min.");

config.plugins.push(filesize())
config.plugins.push(uglify({
  output: { comments: /@preserve/ }
}))

export default config;
github cdes / figma-plus-advanced-rename-plugin / rollup.config.js View on Github external
// browser-friendly UMD build
	{
		input: 'src/index.js',
		output: {
			name: pkg.name,
			file: `${pkg.files[0]}/${pkg.name}.js`,
			format: 'umd'
		},
		plugins: [
			distCleaner(),
			resolve(),
      babel({runtimeHelpers: true,}),
      cjs(),
			DEVELOPMENT && RUN && run(), // Dev mode: run the bundle to see output in console/terminal
			(DEVELOPMENT || SERVE) && serve(devServerOptions), // Dev Serve mode: serve  bundle
			PRODUCTION && uglify(), // Production: uglify bundle,
			sass({
				output: `./dist/${pkg.name}.css`,
			}),
			logger(),
    ],
	},
];
github daniel3735928559 / guppy / rollup.config.js View on Github external
'lib/katex/**'
            ],
	    namedExports: { 'mousetrap': ['Mousetrap'] }
	}),
	json({
            include: ['sym/**']
	}),
	babel({
            exclude: 'node_modules/**',
            presets: [['es2015', { "modules": false }]],
	    plugins: (process.env.NODE_ENV === 'test' ? [['istanbul', {"include": ['src/**']}]] : [])
	}),
	//(process.env.NODE_ENV === 'test' && istanbul({
	//    include: ['src/**']
	//})),
	(process.env.NODE_ENV === 'production' && uglify()),
    ],
};
github gka / chroma.js / rollup.config.js View on Github external
},
        plugins: [
            resolve(),
            commonjs(),

        replace({
                delimiters: ['@@', ''],
                'version': require('./package.json').version
            }),

            // If we're building for production (npm run build
            // instead of npm run dev), transpile and minify
            buble({
                transforms: { dangerousForOf: true }
            }),
            minify && uglify({
                 mangle: true
            }),
            license({
                sourcemap: true,
                //cwd: '.', // Default is process.cwd()

                banner: {
                    content: {
                        file: path.join(__dirname, 'LICENSE')
                    }
                }
            }),
        ]
    }
}
github xiguaxigua / numerify / build / build.js View on Github external
const babel = require('rollup-plugin-babel')
const formatList = ['es', 'cjs', 'umd']
const eslint = require('rollup-plugin-eslint')
const minify = require('uglify-es').minify
const resolve = require('rollup-plugin-node-resolve')
const common = require('rollup-plugin-commonjs')
const pluginList = require('../src/plugin-list')

for (let i = 0; i < 2; i++) {
  const plugins = [
    resolve(),
    common(),
    eslint(),
    babel()
  ]
  if (i) plugins.push(uglify({}, minify))
  rollup.rollup({
    input: 'src/index.js',
    plugins
  }).then(bundle => {
    for (let j = 0; j < 3; j++) {
      const type = formatList[j]
      bundle.write({
        format: type,
        name: 'numerify',
        file: `lib/index.${type}${i ? '.min' : ''}.js`
      }).catch(e => {
        console.log(e)
        process.exit(1)
      })
    }
  }).catch(e => {
github ElemeFE / v-charts / build / rollup.config.js View on Github external
async function rollupFn (item) {
  const { min, dist, suffix, src: input, type: format, globalName: name } = item
  const vueSettings = min
    ? { css: 'lib/style.min.css', postcss: [autoprefixer, cssnano] }
    : { css: 'lib/style.css', postcss: [autoprefixer] }
  const plugins = [
    eslint(),
    vue(vueSettings),
    resolve({ extensions: ['.js', '.vue'] }),
    babel({ plugins: ['external-helpers'] })
  ]
  if (min) plugins.push(uglify({}, minify))

  const distPath = '../' + dist + suffix
  const isCommonjs = format === 'cjs'
  let reg = isCommonjs
    ? /(^(echarts|numerify|utils-lite)|(\/core|\/utils|\/constants)$)/
    : /^(echarts)/
  const external = id => reg.test(id)
  const globals = { 'echarts/lib/echarts': 'echarts' }

  const bundle = await rollup.rollup({ input, external, plugins })
  let { code } = await bundle.generate({ format, name, globals })
  if (isCommonjs) {
    code = code.replace(
      /require\(['"](..?\/)+(utils|core|constants)['"]\)/g,
      'require(\'./$2\')'
    )
github videojs / generator-videojs-plugin / generators / app / templates / scripts / _primed-rollup-plugins.js View on Github external
babel: babel({
    babelrc: false,
    exclude: 'node_modules/**',
    presets: [
      ['env', {loose: true, modules: false, targets: {browsers: browsersList}}]
    ],
    plugins: [
      'external-helpers',
      'transform-object-assign'
    ]
  }),
  commonjs: commonjs({sourceMap: false}),
  json: json(),
  multiEntry: multiEntry({exports: false}),
  resolve: resolve({browser: true, main: true, jsnext: true}),
  uglify: uglify({output: {comments: 'some'}}, minify)
};
github psychobolt / react-pie-menu / rollup.config.prod.js View on Github external
function getConfig(pathname, base) {
  const dist = path.resolve(pathname, 'dist');
  return {
    ...base,
    output: {
      file: path.resolve(dist, 'index.prod.js'),
      format: 'cjs',
      exports: 'named',
    },
    plugins: [
      ...base.plugins,
      uglify({}, minify),
    ],
  };
}
github shshaw / Splitting / config / rollup.all.compressed.js View on Github external
import size from 'rollup-plugin-filesize';
import { uglify } from 'rollup-plugin-uglify';
import { minify } from 'uglify-js';
import uglifyOptions from './compress.json';

export default {
  input: 'src/all.js', 
  output: [ 
    { file: 'dist/splitting.min.js', name: 'Splitting', format: 'umd' },
  ],
  plugins: [
    size(),
    uglify(uglifyOptions, minify)
  ]
}
github victor0210 / HAjax / build / rollup.prod.js View on Github external
import { uglify } from 'rollup-plugin-uglify'
import copy from 'rollup-plugin-copy-glob'
import base from '../rollup.config'

base[0].plugins.push(uglify())
base[0].plugins.push(copy([
  { files: 'src/**', dest: 'release' },
  { files: 'package.json', dest: 'release' },
  { files: 'README.md', dest: 'release' }
]))

export default base

rollup-plugin-uglify

Rollup plugin to minify generated bundle

MIT
Latest version published 5 years ago

Package Health Score

47 / 100
Full package analysis

Popular rollup-plugin-uglify functions