This repository was archived by the owner on Jan 18, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +37
-11
lines changed
Expand file tree Collapse file tree 5 files changed +37
-11
lines changed Original file line number Diff line number Diff line change 33 "scripts" : {
44 "build" : " rollup -c --environment BUILD:production"
55 },
6- "main" : " ./dist/MyComponent .ssr.js" ,
7- "module" : " ./dist/MyComponent .esm.js" ,
8- "browser" : " ./dist/MyComponent .js" ,
9- "unpkg" : " ./dist/MyComponent .js" ,
6+ "main" : " ./dist/library .ssr.js" ,
7+ "module" : " ./dist/library .esm.js" ,
8+ "browser" : " ./dist/library .js" ,
9+ "unpkg" : " ./dist/library .js" ,
1010 "devDependencies" : {
1111 "rollup" : " ^0.59.4" ,
1212 "rollup-plugin-css-only" : " ^0.4.0" ,
Original file line number Diff line number Diff line change @@ -3,21 +3,21 @@ import vue from 'rollup-plugin-vue'
33export default [
44 // ESM build to be used with webpack/rollup.
55 {
6- input : 'src/MyComponent.vue ' ,
6+ input : 'src/index.js ' ,
77 output : {
88 format : 'esm' ,
9- file : 'dist/MyComponent .esm.js'
9+ file : 'dist/library .esm.js'
1010 } ,
1111 plugins : [
1212 vue ( )
1313 ]
1414 } ,
1515 // SSR build.
1616 {
17- input : 'src/MyComponent.vue ' ,
17+ input : 'src/index.js ' ,
1818 output : {
1919 format : 'cjs' ,
20- file : 'dist/MyComponent .ssr.js'
20+ file : 'dist/library .ssr.js'
2121 } ,
2222 plugins : [
2323 vue ( { template : { optimizeSSR : true } } )
@@ -28,7 +28,7 @@ export default [
2828 input : 'src/wrapper.js' ,
2929 output : {
3030 format : 'iife' ,
31- file : 'dist/MyComponent .js'
31+ file : 'dist/library .js'
3232 } ,
3333 plugins : [
3434 vue ( )
Original file line number Diff line number Diff line change 1+ <template >
2+ <h1 >Hello {{ name }}</h1 >
3+ </template >
4+
5+ <script >
6+ export default {
7+ data () {
8+ return { name: ' Jane Doe' }
9+ }
10+ }
11+ </script >
12+
13+ <style scoped>
14+ h1 {
15+ color : red ;
16+ }
17+ </style >
Original file line number Diff line number Diff line change 1+ import MyComponent from './MyComponent.vue'
2+ import OtherComponent from './OtherComponent.vue'
3+
4+ export {
5+ MyComponent ,
6+ OtherComponent
7+ }
Original file line number Diff line number Diff line change 1- import MyComponent from './MyComponent.vue '
1+ import * as components from './index '
22
33if ( typeof Vue !== 'undefined' ) {
4- Vue . component ( 'MyComponent' , MyComponent )
4+ for ( const name in components ) {
5+ Vue . component ( name , components [ name ] )
6+ }
57}
You can’t perform that action at this time.
0 commit comments