|
|
|
import { defineConfig } from 'rollup'
|
|
|
|
|
|
|
|
import resolve from '@rollup/plugin-node-resolve'
|
|
|
|
import babel from '@rollup/plugin-babel'
|
|
|
|
import { terser } from 'rollup-plugin-terser'
|
|
|
|
import esbuild from 'rollup-plugin-esbuild'
|
|
|
|
|
|
|
|
export default defineConfig([
|
|
|
|
{
|
|
|
|
input: 'src/base.js',
|
|
|
|
output: {
|
|
|
|
file: 'out/base.min.js',
|
|
|
|
format: 'iife',
|
|
|
|
},
|
|
|
|
plugins: [terser()],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: 'src/utenti.js',
|
|
|
|
external: ['alpinejs', 'fuse.js'], // libraries to not bundle
|
|
|
|
output: {
|
|
|
|
file: 'out/utenti.min.js',
|
|
|
|
format: 'iife',
|
|
|
|
globals: {
|
|
|
|
// map library names to global constants
|
|
|
|
alpinejs: 'Alpine',
|
|
|
|
'fuse.js': 'Fuse',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [terser()],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: 'src/profilo.js',
|
|
|
|
external: ['alpinejs'],
|
|
|
|
output: {
|
|
|
|
file: 'out/profilo.min.js',
|
|
|
|
format: 'iife',
|
|
|
|
globals: {
|
|
|
|
alpinejs: 'Alpine',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
plugins: [terser()],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: 'src/homepage-art.ts',
|
|
|
|
output: {
|
|
|
|
file: 'out/homepage-art.min.js',
|
|
|
|
format: 'iife',
|
|
|
|
},
|
|
|
|
plugins: [esbuild({ minify: true })],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: 'src/appunti-condivisi/main.jsx',
|
|
|
|
output: {
|
|
|
|
file: 'out/appunti-condivisi.min.js',
|
|
|
|
format: 'iife',
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
resolve(),
|
|
|
|
babel({
|
|
|
|
babelHelpers: 'bundled',
|
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
'@babel/preset-react',
|
|
|
|
{
|
|
|
|
runtime: 'automatic',
|
|
|
|
importSource: 'preact',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
// https://rollupjs.org/guide/en/#-w--watch
|
|
|
|
!process.env.ROLLUP_WATCH && terser(),
|
|
|
|
],
|
|
|
|
},
|
|
|
|
])
|