Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Config
// =============================================================================
// Base
const config = {
input : entryFile,
output: {
banner : `/*!\n * ${ bannerData.join('\n * ') }\n */`,
file : outputFile,
sourcemap: true
},
plugins: [
resolve(),
commonjs(),
json(),
postcss(pluginSettings.postcss),
eslint(pluginSettings.eslint),
babel(pluginSettings.babel)
],
watch: {
clearScreen: false
}
};
// Formats
// -----------------------------------------------------------------------------
// IIFE
const iife = merge({}, config, {
output: {
format: 'iife'
},
plugins: config.plugins.concat([
uglify(pluginSettings.uglify.beautify)
// Config
// =============================================================================
// Base
const config = {
input : entryFile,
output: {
file : outputFile,
name : outputName,
banner : `/*!\n * ${ bannerData.join('\n * ') }\n */`,
sourcemap: true
},
plugins: [
resolve(),
commonjs(),
json(),
eslint(pluginSettings.eslint),
babel(pluginSettings.babel)
],
watch: {
clearScreen: false
}
};
// Formats
// -----------------------------------------------------------------------------
// ES Module
const esm = merge({}, config, {
output: {
file : config.output.file.replace(/\.js$/, '.esm.js'),
format: 'esm'
},
plugins: [
// Config
// =============================================================================
// Base
const config = {
input : entryFile,
output: {
file : outputFile,
name : outputName,
banner : `/*!\n * ${ bannerData.join('\n * ') }\n */`,
sourcemap: true
},
plugins: [
resolve(),
commonjs(),
json(),
eslint(pluginSettings.eslint),
babel(pluginSettings.babel)
],
watch: {
clearScreen: false
}
};
// Formats
// -----------------------------------------------------------------------------
// ES Module
const esm = merge({}, config, {
output: {
file : config.output.file.replace(/\.js$/, '.esm.js'),
format: 'esm'
},
plugins: config.plugins.concat([
// Config
// =============================================================================
// Base
const config = {
input : entryFile,
output: {
file : outputFile,
name : outputName,
banner : `/*!\n * ${ bannerData.join('\n * ') }\n */`,
sourcemap: true
},
plugins: [
resolve(),
commonjs(),
json(),
eslint(pluginSettings.eslint)
],
watch: {
clearScreen: false
}
};
// Formats
// -----------------------------------------------------------------------------
// ES Module
const esm = merge({}, config, {
output: {
file : config.output.file.replace(/\.js$/, '.esm.js'),
format: 'esm'
},
plugins: config.plugins.concat([
babel(pluginSettings.babel.es6),
// Config
// =============================================================================
// Base
const config = {
input : entryFile,
output: {
file : outputFile,
banner : `/*!\n * ${ bannerData.join('\n * ') }\n */`,
sourcemap: true
},
plugins: [
resolve(),
commonjs(),
json(),
eslint(pluginSettings.eslint),
babel(pluginSettings.babel)
],
watch: {
clearScreen: false
}
};
// Formats
// -----------------------------------------------------------------------------
// IIFE
const iife = merge({}, config, {
output: {
format: 'iife'
},
plugins: [
uglify(pluginSettings.uglify.beautify)
// Required for demo bundle and development environment
const demo = {
input: 'src/index.js',
output: {
file: 'demos/js/a11y-dialog-component.js',
format: 'iife',
name: 'Dialog',
exports: 'named',
sourcemap: true,
},
watch: {
clearScreen: false,
},
plugins: [
!production && eslint(),
babel({
exclude: 'node_modules/**',
}),
],
};
production ? bundle.push(cjs, esm, iife, demo) : bundle.push(demo);
export default bundle;
const nameExport = options.nameExport;
const type = options.type;
const comment = `${type === "executable" ? "#!/usr/bin/env node\n" : ""}/**
* ${name} v${version}
* Copyright 2016-2019 Kabir Shah
* Released under the MIT License
* https://kbrsh.github.io/moon
*/\r\n`;
try {
const bundle = await rollup.rollup({
input: path.join(packagesPath, `${package}/src/index.js`),
plugins: [
resolver,
eslint(),
babel()
],
onwarn: warning => {
if (warning.code !== "CIRCULAR_DEPENDENCY") {
console.warn(`Rollup [Warn]: ${warning}`);
}
}
});
let { output } = await bundle.generate({
name: nameExport,
format: "iife"
});
output = output[0].code;
file: `./dist/${path.basename(app.main)}`,
format: 'umd',
name: 'ReactStepWizard',
exports: 'named',
globals: {
'prop-types': 'PropTypes',
react: 'React',
},
},
external: [
'prop-types',
'react',
],
context: 'this',
plugins: [
isProd && eslint({
throwOnError: true,
throwOnWarning: true,
exclude: ['node_modules/**', '**/**/*.less', '**/**/*.css'],
}),
babel({
exclude: 'node_modules/**',
}),
postcss({
modules: {
generateScopedName: 'rsw_[hash:base64:2]',
},
}),
isProd && uglify(),
filesize(),
],
};
return gulp.src(component.src)
.pipe(
rollup({
input: component.entry,
output: {
name: 'ImageCropper',
format: 'iife',
},
plugins: [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
eslint('.eslintrc'),
babel({
presets: ['es2015-rollup'],
plugins : [
'check-es2015-constants',
'transform-minify-booleans',
'transform-property-literals',
'transform-member-expression-literals',
]
}),
uglify()
],
})
)
.pipe(rename({
suffix : '.min'
}))