Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions .vue.webpack.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default [
},
{
// Modules
files: ["js/modules/**", "eslint.config.mjs"],
files: ["js/modules/**", "eslint.config.mjs", "vite.config.js"],
languageOptions: {
sourceType: "module"
}
Expand Down Expand Up @@ -169,7 +169,7 @@ export default [
},
{
// Config files
"files": ["eslint.config.mjs", ".stylelintrc.js", ".webpack.config.js", ".vue.webpack.config.js", "tests/cypress.config.js"],
"files": ["eslint.config.mjs", ".stylelintrc.js", ".webpack.config.js", ".vue.webpack.config.js", "tests/cypress.config.js", "vite.config.js"],
"languageOptions": {
"globals": {...globals.node}
},
Expand Down
22 changes: 7 additions & 15 deletions js/src/vue/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* ---------------------------------------------------------------------
*/

import { createApp } from 'vue/dist/vue.esm-bundler.js';
import * as vue from "vue";

let existing_components = {};
Expand All @@ -41,7 +40,7 @@ if (window.Vue !== undefined && window.Vue.components !== undefined) {
window.Vue = {
createApp: (...args) => {
// pass arguments directly to createApp
const app = createApp(...args);
const app = vue.createApp(...args);
// add default global properties so they can be used within the templates
app.config.globalProperties.__ = __;
app.config.globalProperties._n = _n;
Expand All @@ -61,26 +60,19 @@ window.Vue = {
return components;
},
};
// Require all Vue SFCs in js/src directory
const component_context = import.meta.webpackContext('.', {
regExp: /\.vue$/i,
recursive: true,
mode: 'lazy',
chunkName: '/vue-sfc/[request]'
});

/* global __webpack_public_path__ */
// eslint-disable-next-line no-global-assign
__webpack_public_path__ = `${CFG_GLPI.root_doc + __webpack_public_path__}/`;
const component_context = import.meta.glob('./**/*.vue', { as: 'component', eager: false });

// Register components globally
const components = {};
component_context.keys().forEach((f) => {
// Ex: ./Debug/Toolbar.vue => DebugToolbar
Object.keys(component_context).forEach((f) => {
// Ex: ./Debug/Toolbar.vue => Debug/Toolbar
const component_name = f.replace(/^\.\/(.+)\.vue$/, '$1');
components[component_name] = {
component: vue.defineAsyncComponent(() => component_context(f)),
component: vue.defineAsyncComponent(component_context[f]),
};
});

// Save components in global scope
window.Vue.components = Object.assign(window.Vue.components, components);

Expand Down
Loading
Loading