enabling vue compat

This commit is contained in:
Giulio Ganci 2022-04-23 16:15:54 +02:00
parent 3cca3ed2b3
commit 3eb781021c
3 changed files with 23 additions and 14 deletions

View File

@ -116,6 +116,7 @@
"electron-store": "^8.0.1",
"electron-updater": "^4.6.1",
"electron-window-state": "^5.0.3",
"encoding": "^0.1.13",
"leaflet": "^1.7.1",
"marked": "^4.0.0",
"moment": "^2.29.1",

View File

@ -1,6 +1,6 @@
'use strict';
import { createApp } from 'vue';
import { createApp, configureCompat } from 'vue';
import '@mdi/font/css/materialdesignicons.css';
import 'leaflet/dist/leaflet.css';
import '@/scss/main.scss';
@ -9,6 +9,11 @@ import App from '@/App.vue';
import { store } from '@/store';
import i18n from '@/i18n';
// @TODO: remove after migrating from vue2 -> vue3
configureCompat({
MODE: 3
});
i18n.global.locale = store.state.settings.locale;
const app = createApp(App);

View File

@ -6,42 +6,45 @@ const { VueLoaderPlugin } = require('vue-loader');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const ProgressPlugin = require('progress-webpack-plugin');
const { dependencies, devDependencies, version } = require('./package.json');
const { version } = require('./package.json');
const { contributors } = JSON.parse(fs.readFileSync('./.all-contributorsrc', 'utf-8'));
const parsedContributors = contributors.reduce((acc, c) => {
acc.push(c.name);
return acc;
}, []).join(',');
const externals = Object.keys(dependencies).concat(Object.keys(devDependencies));
const isDevMode = process.env.NODE_ENV !== 'production';
const whiteListedModules = ['vue'];
const whiteListedModules = ['.bin', 'vue', '@vue'];
const externals = {};
fs.readdirSync('node_modules')
.filter(x => whiteListedModules.indexOf(x) === -1)
.forEach(mod => {
externals[mod] = `commonjs ${mod}`;
});
const config = {
name: 'renderer',
mode: process.env.NODE_ENV,
devtool: isDevMode ? 'eval-source-map' : false,
entry: {
renderer: path.join(__dirname, './src/renderer/index.js')
},
devtool: isDevMode ? 'eval-cheap-module-source-map' : false,
entry: path.join(__dirname, './src/renderer/index.js'),
target: 'electron-renderer',
output: {
libraryTarget: 'commonjs2',
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
publicPath: ''
filename: 'renderer.js'
},
node: {
global: true,
__dirname: isDevMode,
__filename: isDevMode
},
externals: externals.filter((d) => !whiteListedModules.includes(d)),
externals: externals,
resolve: {
alias: {
// vue$: 'vue/dist/vue.common.js',
'@': path.resolve(__dirname, 'src/renderer'),
common: path.resolve(__dirname, 'src/common')
common: path.resolve(__dirname, 'src/common'),
// @TODO: remove after migrating from vue2 -> vue3
vue: '@vue/compat'
},
extensions: ['', '.js', '.vue', '.json'],
fallback: {