Skip to content

Commit af8bbe6

Browse files
Merge pull request #4 from philippilievskibearingpointcom/refactor/extract-openscd-dependencies
feature: add translations for editor-plugins
2 parents eb17e0d + 65e12a2 commit af8bbe6

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

build-plugins.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ async function buildAll() {
5252
const outFileName = baseName.toLowerCase();
5353

5454
// Build configuration with output in a subfolder based on the plugin type.
55+
// Externalize common libraries like lit-element, lit-html, and lit-translate.
5556
const config = defineConfig({
5657
build: {
5758
outDir: distDir, // Global output folder is the root-level "dist"
@@ -63,12 +64,18 @@ async function buildAll() {
6364
formats: ['es'],
6465
},
6566
rollupOptions: {
67+
// Prevent bundling duplicate copies of shared dependencies.
68+
external: ['lit-element', 'lit-html', 'lit-translate'],
6669
output: {
67-
inlineDynamicImports: true,
70+
// Optionally define globals if you need UMD builds or similar.
71+
globals: {
72+
'lit-element': 'LitElement',
73+
'lit-html': 'litHtml',
74+
'lit-translate': 'litTranslate'
75+
},
6876
},
6977
},
7078
target: 'esnext',
71-
// The folder is already cleared – no need for Vite to empty it.
7279
emptyOutDir: false,
7380
configFile: false,
7481
},

libs/openscd/open-scd/src/translations/i18n-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { loader } from './loader.js';
44
registerTranslateConfig({ loader, empty: key => key });
55

66
const language = localStorage.getItem('language') || 'en';
7+
console.log("SETTING LANGUAGE TO", language);
78
use(language);
89

910
export function setLanguage(lang) {

0 commit comments

Comments
 (0)