Vue.js as Distributable Library
Vue.js as Distributable Library Github: https://github.com/Ansonhkg/distributable-vue-library/ Demo Cheat sheet Expected Usage Your Project Foo index.html Inside <head>
1 2 3 4 |
<!-- your built vue library --> <script src="https://unpkg.com/vue"></script> <script src="./v/0.0.1/configure.umd.min.js"></script> <link rel="stylesheet" href="./v/0.0.1/configure.css"> |
before </body>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<!-- place this before </body> --> <div id="configure-app"> <configure-app></configure-app> </div> <script> const vm = new Vue({ components: { configureApp: configure } }).$mount('#configure-app'); const configureApp = vm.$options.components.configureApp.methods; </script> |
Your Vue APP Build your app with this command
1 |
yarn build --target lib --inline-vue --name configure --dest v/0.0.1 |
Reference: https://cli.vuejs.org/guide/build-targets.html#library