1
1
2
2
const devServer = require ( 'nollup/lib/dev-server' )
3
+ const hmr = require ( 'rollup-plugin-hot' )
3
4
4
5
module . exports . default = {
5
6
dependencies : { 'rollup' : ( ) => require ( '../rollup' ) } ,
@@ -9,18 +10,40 @@ module.exports.default = {
9
10
event : 'start' ,
10
11
condition : 'development' ,
11
12
// Nollup needs the Rollup config, so make sure Rollup compiles its config
12
- action : app => app . config . rollup . compileConfig = true
13
+
14
+ action : ( app , params ) => {
15
+ app . merge ( {
16
+ config : {
17
+ rollup : { compileConfig : true } ,
18
+ nollup : {
19
+ port : params . port || app . config . roxi . port ,
20
+ contentBase : app . config . roxi . staticDir ,
21
+ hot : true ,
22
+ publicPath : 'build' ,
23
+ historyApiFallback : '/__index.html' ,
24
+ }
25
+ }
26
+ } )
27
+ }
13
28
} ,
14
29
{
15
30
name : 'start nollup server' ,
16
31
event : 'after:bundle' ,
17
32
condition : 'development' ,
18
33
action : async ( app , params , ctx ) => {
34
+ const { staticDir } = app . config . roxi
35
+
19
36
//start the nollup dev server
20
37
devServer ( {
21
38
port : params . port || app . config . roxi . port ,
22
39
contentBase : app . config . roxi . staticDir ,
23
- config : app . config . rollup ,
40
+ config : {
41
+ ...app . config . rollup ,
42
+ plugins : [
43
+ ...app . config . rollup . plugins . filter ( plugin => plugin . name !== 'hot' ) ,
44
+ hmr ( { inMemory : true , public : staticDir , compatNollup : true } )
45
+ ]
46
+ } ,
24
47
hot : true ,
25
48
publicPath : 'build' ,
26
49
historyApiFallback : '/__index.html' ,
0 commit comments