forked from phc/website
Nested makefile and libraries from CDN
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
|
||||
JS_SOURCES = src/utenti.js
|
||||
JS_BUNDLES = $(patsubst src/%.js, dist/%.min.js, $(JS_SOURCES))
|
||||
|
||||
.PHONY: all
|
||||
all: $(JS_BUNDLES)
|
||||
|
||||
dist/%.min.js: src/%.js
|
||||
rollup -c rollup.config.js $<
|
||||
|
||||
.PHONY: debug
|
||||
debug:
|
||||
@echo "JS_SOURCES = $(JS_SOURCES)"
|
||||
@echo "JS_BUNDLES = $(JS_BUNDLES)"
|
||||
@@ -1,15 +1,24 @@
|
||||
import { defineConfig } from 'rollup'
|
||||
|
||||
import { nodeResolve } from '@rollup/plugin-node-resolve'
|
||||
// import resolve from '@rollup/plugin-node-resolve'
|
||||
import { terser } from 'rollup-plugin-terser'
|
||||
|
||||
export default defineConfig([
|
||||
{
|
||||
input: 'src/utenti.js',
|
||||
external: ['alpinejs', 'fuse.js'], // libraries to not bundle
|
||||
output: {
|
||||
file: 'dist/utenti.min.js',
|
||||
format: 'es',
|
||||
format: 'iife',
|
||||
globals: {
|
||||
// map library names to global constants
|
||||
alpinejs: 'Alpine',
|
||||
'fuse.js': 'Fuse',
|
||||
},
|
||||
},
|
||||
plugins: [terser(), nodeResolve()],
|
||||
plugins: [
|
||||
// resolve(),
|
||||
terser(),
|
||||
],
|
||||
},
|
||||
])
|
||||
|
||||
@@ -78,5 +78,3 @@ Alpine.data('utenti', () => ({
|
||||
console.timeEnd('search')
|
||||
},
|
||||
}))
|
||||
|
||||
Alpine.start()
|
||||
|
||||
Reference in New Issue
Block a user