Skip to content

Commit

Permalink
Merge pull request #15 from THEOplayer/fix-conviva-bundle-size
Browse files Browse the repository at this point in the history
Fix bundle size of Conviva connector
  • Loading branch information
MattiasBuelens authored Apr 5, 2024
2 parents c0966e0 + ef2fac9 commit 34e43ab
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 63 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-carpets-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@theoplayer/conviva-connector-web": patch
---

Fixed an issue where the THEOplayer library and the Yospace connector were accidentally bundled together with the Conviva connector.
2 changes: 1 addition & 1 deletion cmcd/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const banner = `
* THEOplayer CMCD Connector v${version}
*/`.trim();

export default getSharedBuildConfiguration(fileName, globalName, banner);
export default getSharedBuildConfiguration({ fileName, globalName, banner });
8 changes: 6 additions & 2 deletions conviva/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const banner = `
/**
* THEOplayer Conviva Connector v${version}
*/`.trim();
const external = ['@convivainc/conviva-js-coresdk', '@theoplayer/yospace-connector-web'];
const globals = {
'@convivainc/conviva-js-coresdk': 'Conviva',
'@theoplayer/yospace-connector-web': 'THEOplayerYospaceConnector'
};


export default getSharedBuildConfiguration(fileName, globalName, banner);
export default getSharedBuildConfiguration({ fileName, globalName, banner, external, globals });
2 changes: 1 addition & 1 deletion nielsen/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ const banner = `
* Nielsen Web Connector v${version}
*/`.trim();

export default getSharedBuildConfiguration(fileName, globalName, banner);
export default getSharedBuildConfiguration({ fileName, globalName, banner });
121 changes: 63 additions & 58 deletions tools/build.mjs
Original file line number Diff line number Diff line change
@@ -1,61 +1,66 @@
import {defineConfig} from "rollup";
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "@rollup/plugin-typescript";
import dts from "rollup-plugin-dts";
import { defineConfig } from 'rollup';
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import dts from 'rollup-plugin-dts';

export function getSharedBuildConfiguration(fileName, globalName, banner) {
return defineConfig([{
input: {
[fileName]: "src/index.ts"
},
output: [
{
dir: "dist",
entryFileNames: "[name].umd.js",
name: globalName,
format: "umd",
indent: false,
banner,
globals: {theoplayer: "THEOplayer"}
export function getSharedBuildConfiguration({ fileName, globalName, banner, external, globals }) {
return defineConfig([
{
input: {
[fileName]: 'src/index.ts'
},
{
dir: "dist",
entryFileNames: "[name].esm.js",
format: "esm",
indent: false,
banner
}
],
plugins: [
nodeResolve({
extensions: [".ts", ".js"]
}),
commonjs({
include: ['node_modules/**', '../node_modules/**']
}),
typescript({
tsconfig: "tsconfig.json",
module: "es2015",
include: ["src/**/*"]
})
]
}, {
input: {
[fileName]: "src/index.ts"
output: [
{
dir: 'dist',
entryFileNames: '[name].umd.js',
name: globalName,
format: 'umd',
indent: false,
banner,
globals: { theoplayer: 'THEOplayer', ...(globals ?? {}) }
},
{
dir: 'dist',
entryFileNames: '[name].esm.js',
format: 'esm',
indent: false,
banner
}
],
external: ['theoplayer', ...(external ?? [])],
plugins: [
nodeResolve({
extensions: ['.ts', '.js']
}),
commonjs({
include: ['node_modules/**', '../node_modules/**']
}),
typescript({
tsconfig: 'tsconfig.json',
module: 'es2015',
include: ['src/**/*']
})
]
},
output: [
{
dir: "dist",
format: "esm",
banner,
footer: `export as namespace ${globalName};`
}
],
plugins: [
dts({
tsconfig: "tsconfig.json",
})
]
}]);
}
{
input: {
[fileName]: 'src/index.ts'
},
output: [
{
dir: 'dist',
format: 'esm',
banner,
footer: `export as namespace ${globalName};`
}
],
external: ['theoplayer', ...(external ?? [])],
plugins: [
dts({
tsconfig: 'tsconfig.json'
})
]
}
]);
}
2 changes: 1 addition & 1 deletion yospace/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const banner = `
* THEOplayer Yospace Connector v${version}
*/`.trim();

export default getSharedBuildConfiguration(fileName, globalName, banner);
export default getSharedBuildConfiguration({ fileName, globalName, banner });

0 comments on commit 34e43ab

Please sign in to comment.