Skip to content

Commit

Permalink
chore(pie-cookie-banner): DSW-000 add a build config to bundle cookie…
Browse files Browse the repository at this point in the history
…-banner with all deps
  • Loading branch information
maledr5 committed Aug 14, 2024
1 parent 576945a commit abdfc38
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions packages/components/pie-cookie-banner/cdn.vite.confg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import { visualizer } from 'rollup-plugin-visualizer';

import { deepmerge } from 'deepmerge-ts';

// https://vitejs.dev/config/
const sharedConfig = ({ build = {}, plugins = [], ...rest }) => defineConfig({
build: deepmerge({
lib: {
entry: {
index: 'src/index.ts',
},
formats: ['es'],
},
rollupOptions: {
external: (id) => {
if (['react', '@lit/react'].includes(id)) {
return true;
}
return false;
},
},
outDir: 'cdn_dist',
}, build),
test: {
dir: '.',
environment: 'jsdom',
globals: true,
include: [
'./src/__tests__/**/*.{spec,test}.{js,ts}',
'./test/unit/**/*.{spec,test}.{js,ts}',
],
exclude: ['**/node_modules/**'],
},
plugins: deepmerge([dts({
insertTypesEntry: true,
outputDir: 'cdn_dist',
rollupTypes: true,
}),
visualizer({
gzipSize: true,
brotliSize: true,
})], plugins),

...rest,
});

export default sharedConfig;
1 change: 1 addition & 0 deletions packages/components/pie-cookie-banner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
},
"scripts": {
"build": "run -T vite build",
"build:cdn": "run -T vite build --config './cdn.vite.confg.js'",
"build:react-wrapper": "npx build-react-wrapper",
"create:manifest": "yarn cem analyze --litelement",
"lint:scripts": "run -T eslint .",
Expand Down

0 comments on commit abdfc38

Please sign in to comment.