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

To help you get started, we’ve selected a few rollup-plugin-visualizer 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 Azure / azure-sdk-for-js / sdk / core / core-tracing / rollup.base.config.js View on Github external
// browser only. Rollup's dead code elimination will remove
          // any code guarded by if (isNode) { ... }
          "if (isNode)": "if (false)"
        }
      }),
      nodeResolve({
        mainFields: ["module", "browser"],
        preferBuiltins: false
      }),
      cjs({
        namedExports: {
          "@opentelemetry/types": ["CanonicalCode", "SpanKind", "TraceFlags"],
          assert: ["ok", "fail", "equal", "deepEqual", "deepStrictEqual", "strictEqual"]
        }
      }),
      viz({ filename: "browser/browser-stats.html", sourcemap: false })
    ]
  };

  if (test) {
    baseConfig.input = "dist-esm/test/**/*.spec.js";
    baseConfig.plugins.unshift(multiEntry({ exports: false }));
    baseConfig.output.file = "test-browser/index.js";

    // Disable tree-shaking of test code.  In rollup-plugin-node-resolve@5.0.0, rollup started respecting
    // the "sideEffects" field in package.json.  Since our package.json sets "sideEffects=false", this also
    // applies to test code, which causes all tests to be removed by tree-shaking.
    baseConfig.treeshake = false;
  }

  return baseConfig;
}
github shipshapecode / shepherd / rollup.config.js View on Github external
'/dist/css/shepherd.css': 'dist/css/shepherd.css',
          '/dist/js/shepherd.js': 'dist/js/shepherd.js',
          '/demo/js/prism.js': 'demo/js/prism.js',
          '/demo/js/welcome.js': 'demo/js/welcome.js',
          '/demo/css/prism.css': 'demo/css/prism.css',
          '/demo/css/welcome.css': 'demo/css/welcome.css',
          '/demo/sheep.svg': 'demo/sheep.svg'
        }
      }
    })
  );
}

plugins.push(license({ banner }));
plugins.push(filesize());
plugins.push(visualizer());

const rollupBuilds = [
  // Generate unminifed bundle
  {
    input: './src/js/shepherd.js',

    output: [
      {
        file: pkg.main,
        format: 'umd',
        name: 'Shepherd',
        sourcemap: true
      },
      {
        file: pkg.module,
        format: 'esm',
github ebates-inc / ebates-chat-kit / rollup.config.js View on Github external
},
    {
      file: pkg.module,
      format: 'es',
      ...commonOutput
    }
  ],
  external: ['react', 'react-dom', 'styled-components'],
  plugins: [
    babel({
      exclude: 'node_modules/**' // only transpile our source code
    }),
    cjs(),
    globals(),
    resolve(),
    process.env.ANALYZE_PACKAGE && visualizer()
  ]
};
github mschipperheyn / screenfull-react / rollup.config.js View on Github external
nodeResolve({
    jsnext: true
  }),
  commonjs({
    // exclude: ['node_modules/**']
    namedExports: {
      'node_modules/prop-types/index.js': ['PropTypes']
    }
  }),
  replace({
    'process.env.NODE_ENV': JSON.stringify('production')
  })
];

if (prod)
  plugins.push(terser(), visualizer({ filename: './bundle-stats.html' }));

const input = 'src/index.js';
const outputName = 'screenfull-react';
const external = ['react', 'react-dom'];
const globals = {
  react: 'React',
  'react-dom': 'ReactDOM'
};

export default {
  input,
  output: [
    {
      name: outputName,
      file: 'dist/screenfull-react.js',
      format: 'cjs',
github Azure / azure-sdk-for-js / sdk / identity / identity / rollup.base.config.js View on Github external
// browser only. Rollup's dead code elimination will remove
          // any code guarded by if (isNode) { ... }
          "if (isNode)": "if (false)"
        }
      }),
      nodeResolve({
        mainFields: ["module", "browser"],
        preferBuiltins: false
      }),
      cjs({
        namedExports: {
          events: ["EventEmitter"],
          "@opentelemetry/types": ["CanonicalCode", "SpanKind", "TraceFlags"]
        }
      }),
      viz({ filename: "browser/browser-stats.html", sourcemap: false })
    ]
  };

  if (test) {
    baseConfig.input = "dist-esm/test/*.spec.js";
    baseConfig.plugins.unshift(multiEntry({ exports: false }));
    baseConfig.output.file = "test-browser/index.js";

    // Disable tree-shaking of test code.  In rollup-plugin-node-resolve@5.0.0, rollup started respecting
    // the "sideEffects" field in package.json.  Since our package.json sets "sideEffects=false", this also
    // applies to test code, which causes all tests to be removed by tree-shaking.
    baseConfig.treeshake = false;
  }

  return baseConfig;
}
github michalkvasnicak / react-apollo-graphql / rollup.config.js View on Github external
!isProduction && 'flow-react-proptypes',
        isProduction && 'transform-react-remove-prop-types',
        !isProduction && [
          'transform-runtime',
          { helpers: false, polyfill: false, regenerator: true },
        ],
        'transform-flow-strip-types',
        'transform-class-properties',
        'transform-object-rest-spread',
        'external-helpers',
      ].filter(Boolean),
      ignore: '**/*.test.js',
      exclude: 'node_modules/**',
    }),
    isProduction && uglify(),
    isProduction && visualizer({ filename: './bundle-stats.html' }),
  ].filter(Boolean),
};
github tbranyen / diffhtml / packages / diffhtml-middleware-logger / rollup.config.js View on Github external
export const globals = { diffhtml: 'diff' };
export const external = ['diffhtml'];

export const output = [{
  file: dests[NODE_ENV],
  format: 'umd',
  exports: 'default',
  name: 'logger',
  sourcemap: false,
}];

export const plugins = [
  NODE_ENV === 'min' && replace({ 'process.env.NODE_ENV': JSON.stringify('production') }),
  babel(),
  nodeResolve({ jsnext: true }),
  NODE_ENV === 'umd' && Visualizer({ filename: './dist/build-size.html' }),
];
github zerobias / effector / tools / builder / rollup.js View on Github external
const getPlugins = (name: string) => ({
  babel: babel({
    runtimeHelpers: false,
    exclude: /(\.re|node_modules.*)/,
  }),
  replace: replace({
    'process.env.NODE_ENV': JSON.stringify('production'),
  }),
  commonjs: commonjs({}),
  resolve: resolve({}),
  sizeSnapshot: sizeSnapshot({
    printInfo: false,
  }),
  analyzer: analyze({
    filename: `stats/${name}.html`,
    title: `${name} size report`,
    sourcemap: true,
    template: 'treemap',
  }),
  analyzerJSON: analyze({
    sourcemap: true,
    json: true,
    filename: `stats/${name}.json`,
  }),
  terser: terser(
    minifyConfig({
      beautify: !!process.env.PRETTIFY,
    }),
  ),
  graph: graphPlugin({
github GerkinDev / vuejs-datatable / rollup.config.js View on Github external
environment === 'production' ?  license( {
			banner: `${ pkg.name } v${ pkg.version }
License: ${ pkg.license }
Repository: ${ pkg.repository.url }
Generated on ${ moment().format( 'YYYY-MM-DD [at] HH:mm:ss' ) }.
By ${ allContributorsString }`,
		} ) : undefined,

		environment === 'production' ? terser({
			compress: {
				passes: 2,
				unsafe: true,
			}
		}) : undefined,

		environment === 'production' ? visualizer( { filename: `./stats/${ iife ? 'iife' : 'esm' }.html` } ) : undefined,

		iife ? babel( {
			exclude: 'node_modules/**',
			extensions: ['.js', '.ts', '.html'],
		} ) : undefined,
	] );
}
github adjesusds / restql / rollup.config.js View on Github external
plugins: [babel()],
  }),
  ...(IS_UMD && {
    output: {
      file: IS_DEVELOPMENT ? pkg.dist : pkg.dist.replace('.js', '.min.js'),
      format: RESTQL_FMT,
      name: pkg.name,
    },
    plugins: [
      builtins(),
      resolve({ browser: true }),
      commonjs({ exclude: 'src/**' }),
      json({ exclude: 'src/**' }),
      globals(),
      babel(),
      IS_DEVELOPMENT && visualizer(),
      IS_PRODUCTION && uglify(),
    ].filter(Boolean),
  }),
}

export default config

rollup-plugin-visualizer

[![NPM Version](https://img.shields.io/npm/v/rollup-plugin-visualizer.svg)](https://npmjs.org/package/rollup-plugin-visualizer) [![Node.js CI](https://github.com/btd/rollup-plugin-visualizer/actions/workflows/node.js.yml/badge.svg)](https://github.com/btd

MIT
Latest version published 11 months ago

Package Health Score

76 / 100
Full package analysis

Popular rollup-plugin-visualizer functions