feat(frontend): make enterprise work

This commit is contained in:
Jack Westbrook
2025-03-03 09:42:52 +01:00
parent b89599a014
commit c7368baa30
2 changed files with 9 additions and 11 deletions
+7 -8
View File
@@ -104,15 +104,14 @@ import { createSystemVariableAdapter } from './features/variables/system/adapter
import { createTextBoxVariableAdapter } from './features/variables/textbox/adapter';
import { configureStore } from './store/configureStore';
// import symlinked extensions
// TODO: Vite has no require.context support yet. Enterprise will need some thought.
// const extensionsIndex = require.context('.', true, /extensions\/index.ts/);
const extensionsIndex = (key: string) => ({});
extensionsIndex.keys = () => [];
type ExtensionExports = {
init: () => void;
addExtensionReducers: () => void;
};
const extensionsExports = extensionsIndex.keys().map((key) => {
return extensionsIndex(key);
});
// import symlinked extensions (use glob so vite doesn't error if no files are found)
const extensions: Record<string, ExtensionExports> = import.meta.glob('./extensions/index.ts', { eager: true });
const extensionsExports = Object.values(extensions);
if (process.env.NODE_ENV === 'development') {
initDevFeatures();
+2 -3
View File
@@ -15,7 +15,7 @@ export default defineConfig({
input: ['./public/app/index.ts', './public/sass/grafana.dark.scss', './public/sass/grafana.light.scss'],
},
outDir: './build',
assetsDir: './',
assetsDir: './assets',
},
server: {
// vite binds to ipv6 by default... and that doesn't work for me locally on mac...
@@ -61,14 +61,13 @@ export default defineConfig({
replacement: '@grafana/schema/src/$1',
},
],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json'],
},
});
/**
This is a Vite plugin for handling angular templates.
https://vitejs.dev/guide/api-plugin.html#simple-examples
The webpack output from https://github.com/WearyMonkey/ngtemplate-loader looks like this:
var code = "\n<div class=\"graph-annotation\">\n\t<div class=\"graph-annotation__header\">\n\t\t</div></div>\n";
Exports