This repository was archived by the owner on Jan 18, 2022. It is now read-only.
File tree 5 files changed +37
-11
lines changed
5 files changed +37
-11
lines changed Original file line number Diff line number Diff line change 3
3
"scripts" : {
4
4
"build" : " rollup -c --environment BUILD:production"
5
5
},
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" ,
10
10
"devDependencies" : {
11
11
"rollup" : " ^0.59.4" ,
12
12
"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'
3
3
export default [
4
4
// ESM build to be used with webpack/rollup.
5
5
{
6
- input : 'src/MyComponent.vue ' ,
6
+ input : 'src/index.js ' ,
7
7
output : {
8
8
format : 'esm' ,
9
- file : 'dist/MyComponent .esm.js'
9
+ file : 'dist/library .esm.js'
10
10
} ,
11
11
plugins : [
12
12
vue ( )
13
13
]
14
14
} ,
15
15
// SSR build.
16
16
{
17
- input : 'src/MyComponent.vue ' ,
17
+ input : 'src/index.js ' ,
18
18
output : {
19
19
format : 'cjs' ,
20
- file : 'dist/MyComponent .ssr.js'
20
+ file : 'dist/library .ssr.js'
21
21
} ,
22
22
plugins : [
23
23
vue ( { template : { optimizeSSR : true } } )
@@ -28,7 +28,7 @@ export default [
28
28
input : 'src/wrapper.js' ,
29
29
output : {
30
30
format : 'iife' ,
31
- file : 'dist/MyComponent .js'
31
+ file : 'dist/library .js'
32
32
} ,
33
33
plugins : [
34
34
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 '
2
2
3
3
if ( typeof Vue !== 'undefined' ) {
4
- Vue . component ( 'MyComponent' , MyComponent )
4
+ for ( const name in components ) {
5
+ Vue . component ( name , components [ name ] )
6
+ }
5
7
}
You can’t perform that action at this time.
0 commit comments