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

To help you get started, we’ve selected a few rollup-plugin-terser 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 / storage / storage-file-datalake / rollup.base.config.js View on Github external
baseConfig.plugins.unshift(multiEntry({ exports: false }));

    // different output file
    baseConfig.output.file = "dist-test/index.node.js";

    // mark assert as external
    baseConfig.external.push("assert", "fs", "path");

    baseConfig.context = "null";

    // 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;
  } else if (production) {
    baseConfig.plugins.push(terser());
  }

  return baseConfig;
}
github Azure / azure-sdk-for-js / sdk / identity / identity / rollup.base.config.js View on Github external
baseConfig.input = "dist-esm/test/**/*.spec.js";
    baseConfig.input = ["dist-esm/test/*.spec.js", "dist-esm/test/node/*.spec.js"];
    baseConfig.plugins.unshift(multiEntry({ exports: false }));

    // different output file
    baseConfig.output.file = "test-dist/index.js";

    // mark assert as external
    baseConfig.external.push("assert");

    // 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;
  } else if (production) {
    baseConfig.plugins.push(terser());
  }

  return baseConfig;
}
github waitingsong / node-win32-api / packages / demo / rollup.config.js View on Github external
},
  )
}

if (pkg.browser) {
  config.push(
    // umd bundle min
    {
      external: nodeModule,
      input: pkg.module,
      plugins: [
        resolve({
          mainFields: ['browser', 'module', 'main']
        }),
        commonjs(),
        production && terser(uglifyOpts),
      ],
      output: {
        amd: { id: name },
        banner,
        file: `${targetDir}/${name}.umd.min.js`,
        format: 'umd',
        globals,
        name,
        sourcemap: production ? true : false,
      },
    },
  )
}

if (pkg.bin) {
  const shebang = `#!/usr/bin/env node\n\n${banner}`
github joeldenning / import-map-overrides / rollup.config.js View on Github external
]
  },
  // Only the global variable API. No UI
  {
    input: "src/import-map-overrides-api.js",
    output: {
      file: "dist/import-map-overrides-api.js",
      format: "iife",
      sourcemap: true
    },
    plugins: [
      babel({
        exclude: "node_modules/**"
      }),
      isProduction &&
        terser({
          compress: {
            passes: 2
          },
          sourcemap: true
        })
    ]
  }
];
github GoogleChrome / workbox / packages / workbox-build / src / lib / bundle.js View on Github external
babel({
      // Disable the logic that checks for local Babel config files:
      // https://github.com/GoogleChrome/workbox/issues/2111
      babelrc: false,
      configFile: false,
      presets: [[presetEnv, {
        targets: {
          browsers: babelPresetEnvTargets,
        },
        loose: true,
      }]],
    }),
  ];

  if (mode === 'production') {
    plugins.push(terser({
      mangle: {
        toplevel: true,
        properties: {
          regex: /(^_|_$)/,
        },
      },
    }));
  }

  const rollupConfig = {
    plugins,
    input: temporaryFile,
  };

  // Rollup will inline the runtime by default. If we don't want that, we need
  // to add in some additional config.
github WeAreGenki / minna-ui / utils / build-component / src / index.ts View on Github external
resolveCss({
              code: css.code,
              map: css.map,
            });
            css.write(pkgStyle);
          },
          preprocess,
        }),
        resolve(),
        commonjs(),
        buble({
          transforms: {
            dangerousForOf: true,
          },
        }),
        terser(terserOpts),
      ],
    });

    const bundleElement = await rollup.rollup({
      input: pkgSvelte,
      plugins: [
        svelte({
          customElement: true,
          preprocess,
          // FIXME: Make this customisable or use a new technique to name tags
          tag: pkgName!.replace('@minna-ui/', 'minna-'),
        }),
        resolve(),
        commonjs(),
        buble({
          transforms: {
github github / webauthn-json / rollup.config.js View on Github external
import { terser } from "rollup-plugin-terser";
import tslint from "rollup-plugin-tslint";
import typescript2 from "rollup-plugin-typescript2";
import * as typescript from "typescript";
import extendedPkg from "./extended/package.json";
import pkg from "./package.json";

const plugins = [
  tslint({}),
  typescript2({
    typescript: typescript,
  }),
];

if (!process.env.ROLLUP_WATCH) {
  plugins.push(terser());
}

const configs = [ {
  input: "src/index.ts",
  output: [
    {
      file: pkg.main,
      format: "umd",
      name: "webauthnJSON",
      sourcemap: true,
    },
    {
      file: pkg.module,
      format: "esm",
      sourcemap: true,
    },
github geakstr / svelte-3-rollup-typescript-vscode / rollup.config.js View on Github external
];

if (isDev) {
  plugins.push(
    serve({
      open: false,
      openPage: "/index.html",
      historyApiFallback: "/index.html",
      contentBase: ["./build"]
    }),
    livereload({
      watch: "build"
    })
  );
} else if (isProd) {
  plugins.push(terser({ sourcemap: true }));
}

module.exports = {
  input: "src/index.ts",
  output: {
    sourcemap: true,
    name: "main",
    file: "build/js/main.js",
    format: "iife"
  },
  plugins
};
github apollographql / apollo-client / config / rollup.config.js View on Github external
}],
    }
  }

  return [
    fromSource('esm'),
    fromESM('cjs'),
    fromESM('umd'),
    {
      input: outputFile('cjs'),
      output: {
        file: outputFile('cjs.min'),
        format: 'esm',
      },
      plugins: [
        minify({
          mangle: {
            toplevel: true,
          },
          compress: {
            global_defs: {
              '@process.env.NODE_ENV': JSON.stringify('production'),
            },
          },
        }),
      ],
    },
  ];
}
github nichollascarter / subjx / rollup.config.js View on Github external
const uglifyESMPlugin = () => {
    return terser();
};

rollup-plugin-terser

Rollup plugin to minify generated es bundle

MIT
Latest version published 4 years ago

Package Health Score

52 / 100
Full package analysis

Popular rollup-plugin-terser functions