Skip to content

Commit

Permalink
Merge pull request writer#406 from FabienArcellier/54-custom-componen…
Browse files Browse the repository at this point in the history
…ts-not-loading-with-cjs-extension

fix: custom components not loading with cjs extension
  • Loading branch information
ramedina86 authored Apr 29, 2024
2 parents 590c2fa + 879e5ba commit 6c21a9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
docs/docs/.vitepress/cache/
docs/docs/.vitepress/temp/
ui/dist/
ui/custom_components_dist/
build/
dist/
src/streamsync.egg-info/
Expand Down
1 change: 1 addition & 0 deletions src/ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ node_modules/
storybook-static/

*storybook.log
/custom_components_dist
4 changes: 2 additions & 2 deletions src/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dev": "vite",
"build": "vite build",
"preview": "vite preview --port 5050",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path ../../.gitignore",
"lint:ci": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --ignore-path ../../.gitignore",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path ../../.gitignore --ignore-path .gitignore",
"lint:ci": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --ignore-path ../../.gitignore --ignore-path .gitignore",
"codegen": "node tools/generator.mjs",
"custom.dev": "vite --config vite.config.custom.ts",
"custom.build": "vite build --config vite.config.custom.ts",
Expand Down
11 changes: 10 additions & 1 deletion src/ui/vite.config.custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,16 @@ export default defineConfig({
entry: ["./src/custom_components"],
formats: ["umd"],
name: "StreamsyncCustomComponentTemplates",
fileName: "templates",
fileName: (format, entryalias: string): string => {
/*
The umd file is generated with a cjs extension since transforming the streamsync package into a module
(https://github.com/streamsync-cloud/streamsync/issues/405).
We use the generated file inside a browser, not a nodejs application.
The cjs extension is not adapted. We implement our own name builder.
*/
return "templates.umd.js";
},
},
rollupOptions: {
external: ["vue", "../injectionKeys"],
Expand Down

0 comments on commit 6c21a9f

Please sign in to comment.