Skip to content

Commit

Permalink
feat: initial support for vue 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hokid committed Apr 7, 2020
1 parent 5ab58a7 commit e2b1357
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 54 deletions.
30 changes: 25 additions & 5 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,34 @@
<hr/>
<vue-loaders name="square-spin" color="black"></vue-loaders>
<hr/>
<ball-beat color="black"></ball-beat>
<hr/>
</div>

<script src="dist/vue-loaders.umd.js"></script>
<script src="dist/loaders/ball-beat.js"></script>
<script src="./dist/vue-loaders.umd.js"></script>
<script src="./dist/loaders/ball-beat.js"></script>
<script>
Vue.use(VueLoaders);
// Vue.use(VueLoadersBallBeat);
new Vue().$mount('#app')
function v2() {
Vue.use(VueLoaders);
Vue.component('ball-beat', VueLoadersBallBeat.component);
new Vue().$mount('#app')
}

function v3() {
const app = Vue.createApp({
components: {
BallBeat: VueLoadersBallBeat.component
}
});

app.use(VueLoaders);
app.mount('#app')
}

const bootstrap = /3\./.test(Vue.version) ? v3 : v2;

bootstrap();

</script>
</body>
</html>
Expand Down
196 changes: 153 additions & 43 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@
"rollup": "1.31.0",
"rollup-plugin-babel": "4.3.3",
"rollup-plugin-postcss": "2.0.6",
"rollup-plugin-uglify": "6.0.4"
"rollup-plugin-uglify": "6.0.4",
"vue": "3.0.0-alpha.11"
},
"peerDependencies": {
"vue": "2.x.x||3.x.x||>=3.0.0-alpha||>=3.0.0-beta||>=3.0.0-rc"
},
"babel": {
"presets": [
Expand Down
13 changes: 11 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ function createBundleOptionsForLoaders(loaders) {
name: getLoaderName(fileName),
file: `./dist/loaders/${fileName}`,
format: 'umd',
esModule: true
esModule: true,
globals: {
'vue': 'Vue'
},
},
external: ['vue'],
plugins: [
resolve(),
commonjs(),
Expand All @@ -40,8 +44,12 @@ export default [
file: pkg.main,
format: 'umd',
exports: 'default',
esModule: true
esModule: true,
globals: {
'vue': 'Vue'
},
},
external: ['vue'],
plugins: [
resolve(),
commonjs(),
Expand All @@ -65,6 +73,7 @@ export default [
output: [
{file: pkg.module, format: 'es'}
],
external: ['vue'],
plugins: [
resolve(),
commonjs(),
Expand Down
Loading

0 comments on commit e2b1357

Please sign in to comment.