rollup-plugin-terser#terser JavaScript Examples
The following examples show how to use
rollup-plugin-terser#terser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: rollup.cjs.js From webrix with Apache License 2.0 | 6 votes |
production = {
...base,
output: {
dir: 'build',
format: 'cjs',
chunkFileNames: '[name].js',
entryFileNames: '[name].js',
preserveModules: true,
preserveModulesRoot: 'src',
sourcemap: false,
exports: 'named',
plugins: [terser()],
},
plugins: [
...base.plugins(),
postcss({minimize: true}),
],
}
Example #2
Source File: rollup.config.js From reoverlay with MIT License | 6 votes |
config = {
input: 'src/index.js',
output: {
file: 'lib/index.js',
format: 'cjs',
exports: 'named',
},
external: ['react', 'react-dom'],
plugins: [
resolve({
browser: true,
}),
babel({
exclude: /node_modules/,
}),
commonjs(),
copy({
targets: [{ src: 'src/ModalWrapper.css', dest: 'lib' }],
}),
terser(),
],
}
Example #3
Source File: rollup.config.js From cf-download-proxy with GNU General Public License v3.0 | 6 votes |
config = {
input: 'src/index.ts',
output: {
file: packageInfo.main,
format: 'iife',
},
plugins: [
resolve(),
commonjs(),
inject({
require: ['node-mock', 'require'],
}),
alias({
entries: {
'node-mock': path.resolve(__dirname, '../src/libs/node-mock.ts'),
'http': path.resolve(__dirname, '../src/libs/node-mock.ts'),
}
}),
rawContentPlugin({
include: ['**.css', '**.txt'],
}),
typescript(),
etaPlugin({
templatesDir: path.resolve(__dirname, '../src/templates'),
}),
terser({
format: {
comments: false
}
})
],
}
Example #4
Source File: rollup.config.js From absurd-sql with MIT License | 6 votes |
function getConfig(entry, filename, perf) {
// Remove the extension
let basename = filename.replace(/\.[^.]*/, '');
return {
input: entry,
output: {
dir: perf ? 'dist/perf' : 'dist',
entryFileNames: filename,
chunkFileNames: `${basename}-[name]-[hash].js`,
format: 'esm',
exports: 'named'
},
plugins: [
!perf &&
alias({
entries: {
'perf-deets': path.resolve(
__dirname,
'./node_modules/perf-deets/noop.js'
)
}
}),
webWorkerLoader({
pattern: /.*\/worker\.js/,
targetPlatform: 'browser',
external: [],
plugins: [terser()]
}),
nodeResolve()
],
...(perf ? { external: ['perf-deets'] } : {})
};
}
Example #5
Source File: rollup.config.js From vue3-json-editor with ISC License | 6 votes |
function createEntry (config) {
const c = {
external: ['vue'],
input: 'components/index.ts',
plugins: [],
output: {
file: config.outFile,
format: config.format,
globals: {
vue: 'Vue'
},
exports: 'named'
},
onwarn
}
if (config.format === 'iife' || config.format === 'umd') {
c.output.name = c.output.name || 'vue3-json-editor'
c.output.extend = true
}
c.plugins = [...plugins]
if (config.mode === 'production') {
c.plugins.push(terser())
}
return c
}
Example #6
Source File: rollup.config.js From fvtt-loot-sheet-npc-5e with MIT License | 6 votes |
config = {
input: "src/lootsheetnpc5e.js",
external: ["../../../../../systems/dnd5e/module/actor/sheets/npc.js"],
output: {
dir: "dist/",
format: "es",
sourcemap: true,
assetFileNames: "[name].[ext]",
},
plugins: [
replace({
// If you would like DEV messages, specify 'development'
// Otherwise use 'production'
'process.env.NODE_ENV': JSON.stringify('production')
}),
nodeResolve({
tippy: true,
}),
sourcemaps(),
copy({
watch: staticFiles,
targets: staticFiles.map((file) => ({
src: `${file}`,
dest: "dist",
})),
}),
terser({ ecma: 2020, keep_fnames: true }),
],
}
Example #7
Source File: createRollupConfig.js From merkur with MIT License | 6 votes |
function createRollupES5Config() {
let config = createRollupConfig();
config.output = [
{
dir: './lib',
entryFileNames: '[name].es5.js',
format: 'cjs',
exports: 'named',
plugins: [getBabelOutputPlugin(babelES5BaseConfig), terser()],
},
];
return config;
}
Example #8
Source File: rollup.config.js From hill-chart with MIT License | 6 votes |
commonOptions = {
plugins: [
cjs({
include: 'node_modules/**',
}),
resolve(),
babel({
exclude: 'node_modules/**',
}),
production && terser(),
postcss({
extract: path.resolve('dist/styles.css'),
plugins: [autoprefixer(), cssnano()],
}),
bundleSize(),
visualizer({
gzipSize: true,
}),
],
}
Example #9
Source File: rollup.config.js From pack11ty with MIT License | 6 votes |
plugins_critical = [
commonjs(),
resolve(),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
babel({
exclude: 'node_modules/**',
}),
process.env.NODE_ENV === 'production' && terser(),
entrypointHashmanifest({
manifestName: path.join(HASH, 'hashes_critical.json'),
}),
]
Example #10
Source File: rollup.config.js From vue-rough-notation with MIT License | 6 votes |
function getConfig ({
file,
format,
}) {
return {
input: path.resolve(__dirname, 'src/index.js'),
output: {
file,
name: 'VueRoughNotation',
format,
},
plugins: [
resolve(),
commonjs(),
babel({
babelHelpers: 'runtime',
plugins: ['@babel/plugin-transform-runtime'],
}),
production && terser(),
],
};
}
Example #11
Source File: rollup.es.js From webrix with Apache License 2.0 | 6 votes |
production = {
...base,
output: {
dir: 'build',
format: 'es',
chunkFileNames: '[name].[format].js',
entryFileNames: '[name].[format].js',
preserveModules: true,
preserveModulesRoot: 'src',
sourcemap: false,
exports: 'named',
plugins: [terser()],
},
plugins: [
...base.plugins(),
postcss({minimize: true}),
],
}
Example #12
Source File: rollup.config.js From tom-select with Apache License 2.0 | 6 votes |
terser_config = terser({
mangle: true,
//toplevel: true, // removes tomSelect footer
format: {
semicolons: false,
comments: function (node, comment) {
var text = comment.value;
var type = comment.type;
if (type == "comment2") {
// multiline comment
return /\* Tom Select/i.test(text);
}
},
},
})
Example #13
Source File: rollup.config.js From easy-toggler with MIT License | 6 votes |
configs = bundles.map(({ input: inputPath, output }) => ({
input: inputPath,
output,
plugins: [
nodeResolve(),
babel({
babelHelpers: 'bundled',
plugins: ['annotate-pure-calls'],
}),
replace({
__DEV__: false,
preventAssignment: true,
}),
output.file.includes('.min.') && terser(),
],
}))
Example #14
Source File: rollup.config.js From on-screen-keyboard-detector with MIT License | 6 votes |
plugins = [
terser({
include: [/^.+\.min\.m?js$/],
output: {
comments: function (node, comment) {
var text = comment.value;
var type = comment.type;
if (type === 'comment2') {
// multiline comment
return /@license/i.test(text);
}
}
}
}),
resolve()
]
Example #15
Source File: rollup.config.js From react-multi-date-picker with MIT License | 6 votes |
function build(dirName) {
return fs.readdirSync("./src/" + dirName).map((path) => {
let name = path
.replace(/^./, (w) => w.toUpperCase())
.replace(/_./g, (w) => w.replace("_", "").toUpperCase());
return {
input: `src/${dirName}/${path}/${path}.js`,
output: [
{
file: `${dirName === "elements" ? "components" : dirName}/${path}.js`,
format: "cjs",
plugins: [terser()],
exports: "named",
},
{
file: `build/${path}.browser.js`,
format: "umd",
plugins: [terser()],
name,
exports: "default",
globals,
},
],
...getProps(),
};
});
}
Example #16
Source File: rollup.config.js From yi-note with GNU General Public License v3.0 | 6 votes |
module.exports = {
input: 'src/index.js',
output: [
{
file: 'dist/index.es.js',
format: 'es',
sourcemap: true
},
{
file: 'dist/index.js',
format: 'iife',
name: 'ExtOauth2',
sourcemap: true
}
],
plugins: [
resolve(),
babel({ exclude: 'node_modules/**' }),
terser({
include: [/^.+\.min\.js$/]
})
]
};
Example #17
Source File: rollup.config.js From tabler-icons with MIT License | 6 votes |
minUmdEsmPlugins = [
babel({
exclude: "node_modules/**",
}),
external(),
resolve(),
commonjs(),
terser(),
filesize(),
]
Example #18
Source File: package.js From jsvectormap with MIT License | 6 votes |
module.exports = [
{
input: INPUT_FILE,
output: {
name: LIBRARY_NAME,
file: 'dist/js/jsvectormap.js',
format: 'umd',
},
plugins: [
resolve(),
babel({ babelHelpers: 'bundled' }),
scss(scssOptions('jsvectormap'))
]
},
{
input: INPUT_FILE,
output: {
name: LIBRARY_NAME,
file: 'dist/js/jsvectormap.min.js',
format: 'umd',
plugins: [ terser() ]
},
plugins: [
resolve(),
babel({ babelHelpers: 'bundled' }),
scss(scssOptions('jsvectormap.min', 'compressed'))
]
}
]
Example #19
Source File: rollup.config.js From wp2vite with MIT License | 6 votes |
config = {
treeshake: {
moduleSideEffects: 'no-external',
propertyReadSideEffects: false,
tryCatchDeoptimization: false,
},
input: {
index: path.resolve(__dirname, 'src/main/start.js'),
cli: path.resolve(__dirname, 'src/main/cli.js'),
},
external: [
...Object.keys(require('./package.json').dependencies),
],
output: {
dir: path.resolve(__dirname, 'dist/'),
entryFileNames: `[name].js`,
chunkFileNames: 'chunks/dep-[hash].js',
exports: 'named',
format: 'cjs',
externalLiveBindings: false,
freeze: false,
},
plugins: [
nodeResolve({
preferBuiltins: true,
}),
babel({
babelHelpers: 'bundled',
exclude: "node_modules/**",
}),
commonjs({
extensions: ['.js'],
ignoreDynamicRequires: true,
}),
json(),
terser(),
],
}
Example #20
Source File: rollup.config.js From skills-client with Apache License 2.0 | 6 votes |
module.exports = {
input: 'src/index.js',
output: {
// need to pass in format, file (and name if format == umd) via cmd line
sourcemap: true,
},
preserveSymlinks: true,
plugins: [
eslint(),
babel({
runtimeHelpers: true,
exclude: 'node_modules/**',
}),
resolve({
browser: true,
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
__skillsClientVersion__: `${pkg.name}-${pkg.version}`,
}),
commonjs(),
terser(), // comment out to remove minimization
],
};
Example #21
Source File: rollup.config.js From vue-iClient3D_for_Cesium with Apache License 2.0 | 6 votes |
function liblist(libName, libSrc, type) { //打包lib按需加载js库
let format = 'es';
if (type) {
format = type
}
return {
input: libSrc,
output: {
file: `lib/${libName}.js`,
format: format
},
plugins: [
scss({ include: /\.scss$/, sass: dartSass }), // 对所有样式文件进行编译
vue(),
babel(),
image(),
terser()
]
}
}
Example #22
Source File: rollup.config.js From svelte with MIT License | 6 votes |
plugins = [
postcss({
extract: 'ax.css',
sourceMap: true
}),
sourcemaps(),
resolve(),
babel({
babelrc: false,
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: [["@babel/env", {targets: {ie: 11}}]]
}),
terser({
output: {comments: keepBanner}
})
]
Example #23
Source File: rollup.config.js From wx-updata with MIT License | 6 votes |
plugins = [
json(),
babel({
exclude: 'node_modules/**',
}),
nodeResolve(), // 告诉 Rollup 如何查找外部模块
commonjs(), // 将 CommonJS 转换成 ES2015 模块
terser(), // 压缩文件
]
Example #24
Source File: rollup.config.js From skills-client with Apache License 2.0 | 6 votes |
module.exports = {
input: 'src/index.js',
output: {
// need to pass in format, file (and name if format == umd) via cmd line
sourcemap: true,
},
preserveSymlinks: true,
plugins: [
eslint(),
babel({
exclude: 'node_modules/**',
}),
alias({
resolve: ['.vue', '.js'],
entries: [
{
find: /^@\/(.*)$/,
replacement: path.resolve(projectRootDir, "src/$1")
},
],
}),
resolve({
browser: true,
}),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
__skillsClientVersion__: `${pkg.name}-${pkg.version}`,
}),
commonjs(),
VuePlugin(),
terser(),
],
};
Example #25
Source File: rollup.node.config.js From shell with MIT License | 6 votes |
plugins = [
build.only('node'),
build.applyVersion(build.version),
babel({
presets: [['@babel/preset-env', { targets: { node: true } }]],
plugins: [
['@babel/plugin-proposal-class-properties', { loose: false }],
['@babel/plugin-proposal-private-methods', { loose: false }]
]
}),
terser(terserCfg)
]
Example #26
Source File: rollup.config.js From aws-ssm-session with MIT License | 6 votes |
function chunk(input, name) {
return {
input: `dist/esm-browser/${input}.js`,
output: {
file: `dist/umd/${name}.min.js`,
format: 'umd',
name,
compact: true,
},
plugins: [nodeResolve({ browser: true }), terser()],
};
}
Example #27
Source File: rollup.config.js From Lambda with MIT License | 6 votes |
productionConfig = {
input: 'src/index.js',
output: {
file: 'dist/react-tabs.production.min.js',
format: 'umd',
name: 'ReactTabs',
globals: {
react: 'React',
},
sourcemap: true,
},
plugins: [
ignore(['prop-types']),
commonjs({ exclude: 'src/**' }),
nodeResolve(),
babel({ plugins: ['transform-react-remove-prop-types'] }),
replace({
'process.env.NODE_ENV': JSON.stringify('production'),
}),
terser(),
],
external: ['react'],
}
Example #28
Source File: rollup.config.js From sdk with MIT License | 6 votes |
export default async function() {
return [{
plugins: [
multiInput(),
json(),
terser(),
commonjs(),
// Temporarily disabled, not sure if required
// since rify is a node module doesnt seem to work
// but would be nice to try embed it
// wasm({
// sync: ['*.wasm'],
// }),
],
input: ['src/**/*.js'],
output: [
{
dir: 'dist',
format: 'esm',
entryFileNames: '[name].js'
},
{
dir: 'dist',
format: 'cjs',
entryFileNames: '[name].cjs'
}
]
}];
}
Example #29
Source File: rollup.config.browser.js From whatsapp-api-client with MIT License | 6 votes |
module.exports = {
input: "src/index.js",
output: [
{
file: "lib/whatsapp-api-client.min.js",
format: "umd",
exports: "default",
name: "whatsAppClient",
plugins: [terser()],
globals: {
fs: "fs",
axios: "axios",
},
},
],
plugins: [
progress({
clearLine: true,
}),
resolve({
browser: true,
}),
commonJS({
include: "node_modules/**",
}),
pluginJson(),
],
external: ["fs"],
};