@@ -7,50 +7,68 @@ import { terser } from 'rollup-plugin-terser';
77import typescript2 from 'rollup-plugin-typescript2' ;
88import rollupResolve from 'rollup-plugin-node-resolve' ;
99import pkg from './package.json' ;
10+ import copy from 'rollup-plugin-copy' ;
1011
1112const extensions = [ '.js' , '.ts' ] ;
1213
1314const external = Object . keys ( pkg . dependencies || '' ) ;
1415const globals = external . reduce ( ( prev , current ) => {
15- const newPrev = prev ;
16- newPrev [ current ] = current ;
17- return newPrev ;
16+ const newPrev = prev ;
17+ newPrev [ current ] = current ;
18+ return newPrev ;
1819} , { } ) ;
1920
2021const defaultConfig = {
21- input : pkg . main ,
22- output : {
23- file : path . resolve ( __dirname , pkg . lib ) ,
24- format : 'cjs' ,
25- banner : '#!/usr/bin/env node' ,
26- globals
27- } ,
28- external,
29- plugins : [
30- typescript2 ( {
31- exclude : 'node_modules/**' ,
32- useTsconfigDeclarationDir : true ,
33- typescript,
34- tsconfig : './tsconfig.json'
35- } ) ,
36- json ( ) ,
37- terser ( ) ,
38- rollupResolve ( {
39- // 查找和打包node_modules中的第三方模块
40- customResolveOptions : {
41- moduleDirectory : 'src'
42- } ,
43- preferBuiltins : true ,
44- } ) ,
45- nodeResolve ( {
46- extensions,
47- modulesOnly : true
48- } ) ,
49- babel ( {
50- exclude : 'node_modules/**' ,
51- extensions
52- } )
53- ]
22+ input : pkg . main ,
23+ output : {
24+ file : path . resolve ( __dirname , pkg . lib ) ,
25+ format : 'cjs' ,
26+ banner : '#!/usr/bin/env node' ,
27+ globals
28+ } ,
29+ external,
30+ plugins : [
31+ typescript2 ( {
32+ exclude : 'node_modules/**' ,
33+ useTsconfigDeclarationDir : true ,
34+ typescript,
35+ tsconfig : './tsconfig.json'
36+ } ) ,
37+ json ( ) ,
38+ terser ( ) ,
39+ rollupResolve ( {
40+ // 查找和打包node_modules中的第三方模块
41+ customResolveOptions : {
42+ moduleDirectory : 'src'
43+ } ,
44+ preferBuiltins : true
45+ } ) ,
46+ nodeResolve ( {
47+ extensions,
48+ modulesOnly : true
49+ } ) ,
50+ babel ( {
51+ exclude : 'node_modules/**' ,
52+ extensions
53+ } ) ,
54+ copy ( {
55+ targets : [
56+ {
57+ src : [ 'templates/vue-lite/*' , '!templates/vue-lite/node_modules' ] ,
58+ dest : 'bin/templates/vue-lite'
59+ } ,
60+ {
61+ src : [ 'templates/vue-next-lite/*' , '!templates/vue-next-lite/node_modules' ] ,
62+ dest : 'bin/templates/vue-next-lite'
63+ } ,
64+ {
65+ src : [ 'templates/react-lite/*' , '!templates/react-lite/node_modules' ] ,
66+ dest : 'bin/templates/react-lite'
67+ }
68+ ] ,
69+ verbose : true
70+ } )
71+ ]
5472} ;
5573
5674export default defaultConfig ;
0 commit comments