Skip to content

Commit

Permalink
Merge pull request #295 from nextcloud/enh/async-loading
Browse files Browse the repository at this point in the history
Enh/async loading
  • Loading branch information
skjnldsv authored Apr 18, 2020
2 parents 3320ac4 + 06128e7 commit 6758d37
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
22 changes: 18 additions & 4 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,29 @@
*
*/

import { generateUrl } from '@nextcloud/router'
import { generateUrl, generateFilePath } from '@nextcloud/router'
import Router from 'vue-router'
import Vue from 'vue'

import Albums from '../views/Albums'
import Timeline from '../views/Timeline'
import Tags from '../views/Tags'
import isMapsInstalled from '../services/IsMapsInstalled'

import { getRequestToken } from '@nextcloud/auth'

// CSP config for webpack dynamic chunk loading
// eslint-disable-next-line
__webpack_nonce__ = btoa(getRequestToken())

// Correct the root of the app for chunk loading
// OC.linkTo matches the apps folders
// OC.generateUrl ensure the index.php (or not)
// We do not want the index.php since we're loading files
// eslint-disable-next-line
__webpack_public_path__ = generateFilePath('photos', '', 'js/')

const Albums = () => import('../views/Albums')
const Tags = () => import('../views/Tags')
const Timeline = () => import('../views/Timeline')

Vue.use(Router)

let mapsPath = generateUrl('/apps/maps')
Expand Down
2 changes: 1 addition & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
path: path.resolve(__dirname, './js'),
publicPath: '/js/',
filename: `${appName}.js`,
chunkFilename: '[name].js?v=[contenthash]',
chunkFilename: `${appName}.[name].js?v=[contenthash]`,
},
module: {
rules: [
Expand Down

0 comments on commit 6758d37

Please sign in to comment.