Smaller export

This commit is contained in:
coyotte508 2020-04-28 17:52:56 +02:00
commit 142f3d4c32
3 changed files with 23 additions and 6 deletions

View file

@ -48,9 +48,17 @@ For now there are three ways to include the viewer:
- By importing individual components: If you want to integrate into an existing Vue APP, for example
- Through `index.ts`, the default export is the `launch` function: The viewer will create its own Vue App on the given selector
- Through `unpkg.com/@gaia-project/viewer`, which will set `window.gaiaViewer` or `global.gaiaViewer`. All dependencies are included in the bundle, including `vue` itself.
- Through `unpkg.com/@gaia-project/viewer`, which will set `window.gaiaViewer` or `global.gaiaViewer`. Here is an example:
If you want something else, like an standalone bundle *without* vue, or a standalone bundle without *any* external dependency, contact us and we will add those.
```html
<script src="//unpkg.com/vue@latest/dist/vue.min.js"></script>
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.min.js"></script>
<script source="//unpkg.com/@gaia-project/viewer">
<link type="text/css" rel="stylesheet" source="//unpkg.com/@gaia-project/viewer/dist/package/viewer.css">
```
If you want something else, contact us.
### launch function

View file

@ -5,7 +5,7 @@
"author": "coyotte508, rzulian",
"scripts": {
"build": "vue-cli-service build",
"package": "vue-cli-service build --target lib --inline-vue src/wrapper.ts",
"package": "vue-cli-service build --target lib src/wrapper.ts",
"prepublishOnly": "npm run package",
"serve": "vue-cli-service serve --port 8080",
"test": "echo \"Error: no test specified\" && exit 1"
@ -18,7 +18,8 @@
"src",
"README.md",
"public",
"dist/package/viewer.umd.min.js"
"dist/package/viewer.umd.min.js",
"dist/package/viewer.css"
],
"dependencies": {
"@gaia-project/engine": "^3.4.1",
@ -40,9 +41,12 @@
"typescript": "^3.8.3",
"vue-property-decorator": "^8.4.1",
"vue-template-compiler": "^2.6.11",
"vuex": "^3.0.1",
"webpack": "^4.16.1"
},
"peerDependencies": {
"bootstrap-vue": "^2.12.0",
"vue": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",

View file

@ -4,7 +4,12 @@ if (process.argv.includes("lib")) {
module.exports = {
lintOnSave: false,
outputDir: path.join(__dirname, "dist/package"),
css: {extract: false}
// css: {extract: false}
chainWebpack: config => {
config.externals({
'bootstrap-vue': 'BootstrapVue'
})
}
}
} else {
module.exports = {