Skip to content

Conversation

@saidy-moregeo
Copy link
Collaborator

@saidy-moregeo saidy-moregeo commented Nov 14, 2025

Vite Migration: Dynamic Import Issues

Critical Issue: MapMixin.js Basemap Loading (BROKEN)

File: src/components/maps/MapMixin.js:176-178

Vite cannot resolve dynamic imports from node_modules with template literal variables:

import(`ol/source/${sourceClassName}.js`)
import(`ol/layer/${layerClassName}.js`)

Error: Module name 'ol/source/XYZ.js' does not resolve to a valid URL
Impact: Basemaps fail to load

Locale File Imports (NOT Working with import.meta.glob)

Files: DatePickerMixin.js, i18n.js, MetadataGroups.vue, Validation.vue

Using import.meta.glob() for locale files fails at runtime with errors like:

Root Cause: Locale files re-export from external packages (e.g., date-fns/locale, @musement/iso-duration). When Vite processes glob imports, it cannot resolve these external bindings from node_modules during static analysis.

Example from DatePickerMixin.js:

// This pattern fails:
const datepickerModules = import.meta.glob('../locales/*/datepicker.js');
const module = await datepickerModules[modulePath]();
// Error: Importing binding name 'en' is not found

@m-mohr m-mohr force-pushed the update/migrate-vue-cli-to-vite branch from ea4562c to 71771d3 Compare November 21, 2025 11:34
@saidy-moregeo saidy-moregeo marked this pull request as ready for review November 21, 2025 18:53
@m-mohr
Copy link
Collaborator

m-mohr commented Nov 22, 2025

@saidy-moregeo Are the issues described at the beginning still relevant?

Comment on lines -9 to +15
<meta name="og:url" id="og-url" content="<%= htmlWebpackPlugin.options.url %>">
<meta property="og:title" id="og-title" content="<%= htmlWebpackPlugin.options.title %>"/>
<meta name="og:url" id="og-url" content="">
<meta property="og:title" id="og-title" content="STAC Browser"/>
<meta name="og:description" id="og-description" content="">
<meta name="og:locale" id="og-locale" content="en">
<meta name="og:site_name" content="<%= htmlWebpackPlugin.options.title %>">
<meta name="og:site_name" content="STAC Browser">
<!-- <script defer="defer" src="/config.js"></script> -->
<title><%= htmlWebpackPlugin.options.title %></title>
<title>STAC Browser</title>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please migrate to use variables again using vite-plugin-html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants