File tree 4 files changed +42
-55
lines changed
4 files changed +42
-55
lines changed Original file line number Diff line number Diff line change @@ -276,38 +276,14 @@ The recommended way to create a Client addon is by creating a new project using
276
276
Then add a ` vue.config.js ` file with the following content:
277
277
278
278
``` js
279
+ const { clientAddonConfig } = require (' @vue/cli-ui' )
280
+
279
281
module .exports = {
280
- // Change the id here
281
- baseUrl: ' /_addon/<client-addon-id>' ,
282
- // You can change the port here
283
- devBaseUrl: ' http://localhost:8042/' ,
284
- configureWebpack: {
285
- output: {
286
- // Important
287
- filename: ' index.js'
288
- }
289
- },
290
- // Don't extract CSS into a separate file
291
- css: {
292
- extract: false
293
- },
294
- // Remove unneeded webpack plugins
295
- chainWebpack : config => {
296
- config .plugins .delete (' preload' )
297
- config .plugins .delete (' prefetch' )
298
- config .plugins .delete (' html' )
299
- config .plugins .delete (' split-vendor' )
300
- config .plugins .delete (' split-vendor-async' )
301
- config .plugins .delete (' split-manifest' )
302
- },
303
- // Configure dev server
304
- devServer: {
305
- headers: {
306
- ' Access-Control-Allow-Origin' : ' *'
307
- },
308
- // You can change the port here
282
+ ... clientAddonConfig ({
283
+ id: ' <client-addon-id>' ,
284
+ // Development port (default 8042)
309
285
port: 8042
310
- }
286
+ })
311
287
}
312
288
```
313
289
Original file line number Diff line number Diff line change
1
+ const { clientAddonConfig } = require ( '@vue/cli-ui' )
2
+
1
3
module . exports = {
2
- baseUrl : '/_addon/vue-webpack' ,
3
- devBaseUrl : 'http://localhost:8042/' ,
4
- configureWebpack : {
5
- output : {
6
- // Important
7
- filename : 'index.js'
8
- }
9
- } ,
10
- css : {
11
- extract : false
12
- } ,
13
- chainWebpack : config => {
14
- config . plugins . delete ( 'preload' )
15
- config . plugins . delete ( 'prefetch' )
16
- config . plugins . delete ( 'html' )
17
- config . plugins . delete ( 'split-vendor' )
18
- config . plugins . delete ( 'split-vendor-async' )
19
- config . plugins . delete ( 'split-manifest' )
20
- } ,
21
- devServer : {
22
- headers : {
23
- 'Access-Control-Allow-Origin' : '*'
24
- } ,
25
- port : 8042
26
- }
4
+ ...clientAddonConfig ( {
5
+ id : 'vue-webpack'
6
+ // port: 8042
7
+ } )
27
8
}
Original file line number Diff line number Diff line change
1
+ exports . clientAddonConfig = function ( { id, port = 8042 } ) {
2
+ return {
3
+ baseUrl : `/_addon/${ id } ` ,
4
+ devBaseUrl : `http://localhost:${ port } /` ,
5
+ configureWebpack : {
6
+ output : {
7
+ // Important
8
+ filename : 'index.js'
9
+ }
10
+ } ,
11
+ css : {
12
+ extract : false
13
+ } ,
14
+ chainWebpack : config => {
15
+ config . plugins . delete ( 'preload' )
16
+ config . plugins . delete ( 'prefetch' )
17
+ config . plugins . delete ( 'html' )
18
+ config . plugins . delete ( 'split-vendor' )
19
+ config . plugins . delete ( 'split-vendor-async' )
20
+ config . plugins . delete ( 'split-manifest' )
21
+ } ,
22
+ devServer : {
23
+ headers : {
24
+ 'Access-Control-Allow-Origin' : '*'
25
+ } ,
26
+ port
27
+ }
28
+ }
29
+ }
Original file line number Diff line number Diff line change 3
3
"version" : " 3.0.0-beta.6" ,
4
4
"author" : " Guillaume Chau" ,
5
5
"license" : " MIT" ,
6
+ "main" : " index.js" ,
6
7
"scripts" : {
7
8
"serve" : " vue-cli-service serve" ,
8
9
"build" : " vue-cli-service build" ,
You can’t perform that action at this time.
0 commit comments