Skip to content

Commit

Permalink
plugins/frontend: Migrate plugins to vite
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Dubenko <[email protected]>
  • Loading branch information
sniok committed Sep 18, 2024
1 parent 900de88 commit 0ca7382
Show file tree
Hide file tree
Showing 20 changed files with 15,434 additions and 28,245 deletions.
2 changes: 1 addition & 1 deletion frontend/src/plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export async function fetchAndExecutePlugins(
// Execute plugins inside a context (not in global/window)
(function (str: string) {
try {
const result = eval(str);
const result = eval(str + `\n//# sourceURL=main.js`);
return result;
} catch (e) {
// We just continue if there is an error.
Expand Down
6 changes: 3 additions & 3 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export default defineConfig({
cors: true,
},
plugins: [
nodePolyfills({
include: ['process', 'buffer', 'stream'],
}),
svgr({
svgrOptions: {
prettier: false,
Expand All @@ -34,9 +37,6 @@ export default defineConfig({
},
}),
react(),
nodePolyfills({
include: ['process', 'buffer', 'stream'],
}),
],
test: {
globals: true,
Expand Down
27 changes: 20 additions & 7 deletions plugins/examples/dynamic-clusters/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions plugins/examples/dynamic-clusters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@
},
"devDependencies": {
"@kinvolk/headlamp-plugin": "^0.9.2"
},
"dependencies": {
"js-yaml": "^4.1.0"
},
"overrides": {
"domain-browser": "npm:dry-uninstall"
}
}
Loading

0 comments on commit 0ca7382

Please sign in to comment.