@@ -9,16 +9,21 @@ const { dts } = require("rollup-plugin-dts");
99
1010const peerDependencies = [ ...Object . keys ( pkg . peerDependencies || { } ) ] ;
1111
12- function makeCdnFilename ( ) {
12+ function makeCdnFilename ( package ) {
1313 const major = pkg . version . split ( "." ) [ 0 ] ;
14- const preRelease = pkg . version . split ( "-" ) [ 1 ] ;
15- let tag = "" ;
1614
15+ let tag = "" ;
16+ const preRelease = pkg . version . split ( "-" ) [ 1 ] ;
1717 if ( preRelease ) {
1818 tag = `-${ preRelease . split ( "." ) [ 0 ] } ` ;
1919 }
2020
21- return `v${ major } ${ tag } .js` ;
21+ let packagePart = "" ;
22+ if ( package ) {
23+ packagePart = `-${ package } ` ;
24+ }
25+
26+ return `v${ major } ${ packagePart } ${ tag } .js` ;
2227}
2328
2429const replaceValues = {
@@ -88,17 +93,19 @@ module.exports = [
8893 external : [ "heresy" , ...peerDependencies ] ,
8994 plugins,
9095 } ,
91- // Legacy build of embedded lib in ESM format, bundling the dependencies
96+
97+ // CDN builds
9298 {
9399 input : "src/lib/embed/index.ts" ,
94100 output : {
95- exports : "named" ,
96- file : `dist/ ${ makeCdnFilename ( ) } ` ,
97- format : "esm " ,
101+ file : `dist/cdn/ ${ makeCdnFilename ( "embed" ) } ` ,
102+ format : "iife" ,
103+ name : "whereby " ,
98104 } ,
99105 plugins : [ nodeResolve ( ) , commonjs ( ) , json ( ) , terser ( ) , replace ( replaceValues ) , typescript ( ) ] ,
100106 } ,
101- // Roll-up .d.ts definition files
107+
108+ // Type definitions
102109 {
103110 input : "src/lib/react/index.ts" ,
104111 output : [ { file : "dist/react/index.d.ts" , format : "es" } ] ,
0 commit comments