Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
typescript,
// By default, the include path only includes the cwd and below, need to include the root of the project
// and build path to be passed to this plugin. This is different front tsconfig.json include
include: ["*.ts", `${__dirname}/**/*.ts`, `${process.cwd()}/**/*.ts`],
// d.ts files are not bundled and by default like include, it only includes the cwd and below
exclude: [
"*.d.ts",
`${__dirname}/**/*.d.ts`,
`${process.cwd()}/**/*.d.ts`
]
}),
// Provide some concise information about the bundle
analyze({
skipFormatted: true,
onAnalysis({
bundleSize,
bundleOrigSize,
bundleReduction,
moduleCount
}) {
if (!commandOptions.silent) {
console.log(
`Bundle size: ${Math.round((bundleSize / 1000000) * 100) / 100}Mb`
);
console.log(
`Original size: ${Math.round((bundleOrigSize / 1000000) * 100) /
100}Mb`
);
console.log(`Reduction: ${bundleReduction}%`);
},
{
input: './src/single-spa.js',
output: {
file: `./lib/system/single-spa${isProduction ? ".min" : ".dev"}.js`,
format: 'system',
sourcemap: true,
},
plugins: [
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
isProduction && (await import('rollup-plugin-terser')).terser(),
useAnalyzer && analyzer()
]
},
]))()
const rollUpConf = args => {
if (args['config-analyze']) {
plugins.push(
analyze({
showExports: true,
summaryOnly: true,
})
);
}
return {
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'es',
exports: 'named',
sourcemap: true,
},
],
watch: {