Skip to content

Commit

Permalink
refactor: optimize code splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Weber committed May 28, 2021
1 parent f2a778f commit 5c065fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/@averjs/vue-app/templates/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ export async function createApp(ssrContext) {

let userReturns = {};
<% const extensions = config.additionalExtensions.join('|'); %>
const entries = <%= `require.context('./', true, /.\\/[^/]+\\/app\\.(${extensions})$/i, 'lazy');` %>;
const mixinContext = <%= `require.context('@/', false, /^\\.\\/app\\.(${extensions})$/i, 'lazy');` %>;
const entries = <%= `require.context('./', true, /.\\/[^/]+\\/app\\.(${extensions})$/i, 'lazy')` %>;
const mixinContext = <%= `require.context('@/', false, /^\\.\\/app\\.(${extensions})$/i, 'lazy')` %>;
const entryMixins = [entries, mixinContext];

for (const entryMixin of entryMixins) {
Expand Down
3 changes: 2 additions & 1 deletion packages/@averjs/vue-app/templates/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import Vue from 'vue';
import VueI18n from 'vue-i18n';
import * as Cookies from 'js-cookie';
import merge from 'lodash/merge';

Vue.use(VueI18n);

export async function createI18n({ isServer, context }) {
const { default: Cookies } = await import('js-cookie');

let i18nConfig = {
locale: 'de',
fallbackLocale: 'de'
Expand Down
4 changes: 2 additions & 2 deletions packages/@averjs/vue-app/templates/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import Vue from 'vue';
import Vuex from 'vuex';
import { ExportVuexStore, config } from '@averjs/vuex-decorators';
import createPersistedState from 'vuex-persistedstate';
import * as Cookies from 'js-cookie';
import merge from 'lodash/merge';

Vue.use(Vuex);
Expand Down Expand Up @@ -119,6 +117,8 @@ The following files have been ignored:${ignoreGlobalStoresList}.
}

if (persistent.length > 0) {
const { default: createPersistedState } = await import('vuex-persistedstate');
const { default: Cookies } = await import('js-cookie');
createPersistedState({
paths: persistent,
storage: {
Expand Down

0 comments on commit 5c065fd

Please sign in to comment.