Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
feat: Codesplit VR player
Browse files Browse the repository at this point in the history
Only load VR player when needed.

Fixes #54
  • Loading branch information
qdot committed Jul 5, 2018
1 parent 2e923f1 commit 35286e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion build/webpack.base.js
Expand Up @@ -19,7 +19,8 @@ module.exports = {
output: {
path: path.resolve('./dist'),
publicPath: '/dist/',
filename: 'build.js'
filename: 'build.js',
chunkFilename: "[name].chunk.js"
},
module: {
rules: [
Expand Down
1 change: 0 additions & 1 deletion src/components/AframeVideoPlayer/AframeVideoPlayer.ts
Expand Up @@ -107,4 +107,3 @@ export default class AframeVideoPlayer extends Vue {
document.querySelector("a-scene").enterVR();
}
}
Vue.component("aframe-video-player", AframeVideoPlayer);
7 changes: 5 additions & 2 deletions src/components/VideoPlayer/VideoPlayer.ts
Expand Up @@ -2,12 +2,10 @@ import Vue from "vue";
import { Component, Model, Prop, Watch } from "vue-property-decorator";
const videoPlayer = require("vue-video-player").videoPlayer;
import videojs from "video.js";
import AframeVideoPlayerComponent from "../AframeVideoPlayer/AframeVideoPlayer.vue";

@Component({
components: {
videoPlayer,
AframeVideoPlayerComponent,
},
})
export default class VideoPlayer extends Vue {
Expand Down Expand Up @@ -131,3 +129,8 @@ export default class VideoPlayer extends Vue {
});
}
}

// Since aframe-video-player is a subcomponent, we can register it as part of
// our component here, then delay load it as needed.
Vue.component("aframe-video-player",
() => import (/* webpackChunkName: "syncydinkvr" */ "../AframeVideoPlayer/AframeVideoPlayer.vue" ));
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -2,7 +2,7 @@
"compilerOptions" : {
"lib": ["es5", "ES2015", "ES2015.promise", "dom", "es6"],
"target": "es6",
"module": "es2015",
"module": "esNext",
"moduleResolution": "node",
"strict": true,
"sourceMap": true,
Expand Down

0 comments on commit 35286e0

Please sign in to comment.