Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
babel(),
]
};
// Add Production or Development settings to the config object
if(process.env.production){
config.sourceMap = false;
config.plugins.push(uglify());
config.plugins.push(sizes());
config.plugins.push(filesize());
} else {
config.sourceMap = true;
}
export default config;
import config from './umd-base-profile.js';
import { terser } from "rollup-plugin-terser";
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(terser({
output: { comments: /@preserve/ }
}))
export default config;
}
if (env === 'production') {
config.plugins.push(
uglify({
compress: {
pure_getters: true, // eslint-disable-line
unsafe: true,
unsafe_comps: true // eslint-disable-line
},
warnings: false
})
);
}
config.plugins.push(filesize());
} else {
config = {
input: './src/base.ts',
output: { format: 'es' },
plugins: [dts()]
};
}
config.plugins.push(
license({
banner: `/*!
* NornJ-React${withEx ? '-' + withEx : ''} v${require('../../package.json').version}
* (c) 2016-2019 Joe_Sky
* Released under the MIT License.
*/`
})
const inputConfig = {
entry: `src/${config.moduleName}.js`,
plugins: [
buble(),
]
};
if (isUMD) {
inputConfig.plugins.push(removeEsModuleFreeze());
} else {
inputConfig.external = Object.keys(pkg.dependencies);
}
if (config.minify) {
inputConfig.plugins.push(uglify());
inputConfig.plugins.push(filesize({
format: {exponent: 0},
render: (opt, size, gzip) => `Estimating ${outputConfig.dest}: ${size}, GZIP : ${gzip}`
}));
}
return rollup(inputConfig)
.then(bundle => bundle.write(outputConfig))
.then(() => console.log('created', outputConfig.dest));
}
babel({
exclude: ['**/*.json'],
}),
json()
);
}
if (env === 'production') {
config.plugins.push(uglify());
}
if (process.env.SERVE === 'true') {
config.plugins.push(serve({contentBase: ['dist', 'examples'], open: true}));
}
config.plugins.push(filesize());
export default config;
file: 'dist/index.js',
format: 'cjs',
},
external: ['react', 'prop-types', 'react-dom', 'lodash.isequal'],
plugins: [
css({ output: 'dist/picky.css' }),
resolve(),
babel({
exclude: 'node_modules/**',
externalHelpers: true,
}),
commonjs({
ignore: ['node_modules/prop-types'],
}),
isProduction && uglify(),
isProduction && filesize(),
],
};
...('umd' === format ? { tsconfigOverride: { compilerOptions: { target: 'es5' } } } : {}),
}),
isProd && minify && terser({
compress: true,
mangle: {
module: 'esm' === format,
properties: { regex: /^_/ },
reserved: [],
safari10: true,
toplevel: true,
},
output: { safari10: true },
safari10: true,
toplevel: true,
}),
isProd && filesize({ showBrotliSize: true }),
];
};
commonjs({
ignoreGlobal: false,
namedExports: {
'node_modules/scheduler/index.js': [
'unstable_scheduleCallback',
'unstable_cancelCallback'
]
}
}),
replace({
__DEV__: prod ? 'false' : 'true',
'process.env.NODE_ENV': prod ? '"production"' : '"development"',
}),
globals(),
prod && terser(),
filesize(),
].filter(Boolean),
external: [
'pixi.js',
'react',
'react-dom'
]
}
}
plugins: [
resolve(),
replace({
exclude: 'node_modules/**',
'process.env.NODE_ENV': JSON.stringify(
process.env.NODE_ENV || 'development'
),
}),
commonjs({
include: /node_modules/,
namedExports: {
'node_modules/prop-types/index.js': ['func'],
},
}),
sourceMaps(),
process.env.NODE_ENV === 'production' && filesize(),
process.env.NODE_ENV === 'production' && (
uglify({}, minify)
)
]
}),
Object.assign({}, shared, {
output: [
{
file: 'dist/react-portalgun.es6.js',
format: 'es',
sourcemap: true,
exports: 'named',
globals: { react: 'React' }
},
{
{
warnings: true,
compress: true,
mangle: {
properties: {
keep_quoted: true,
reserved
},
reserved
},
module: true,
toplevel: true,
sourcemap: true,
}
),
filesize()
].filter(Boolean)
}
return conf
}