@@ -6,27 +6,6 @@ function getPath(folder) {
66}
77
88const defaultConfig = {
9- asset : {
10- path : 'static/' ,
11- src : {
12- path : 'src/' ,
13- js : 'src/static/js' ,
14- img : 'src/static/img' ,
15- view : 'src/template' ,
16- } ,
17- build : {
18- path : 'static/build' ,
19- img : 'static/build/img' ,
20- view : 'view/build/' ,
21- } ,
22- dist : {
23- path : 'static/dist' ,
24- js : 'static/dist/js' ,
25- css : 'static/dist/css' ,
26- img : 'static/dist/img' ,
27- view : 'view/dist/' ,
28- } ,
29- } ,
309 dev : {
3110 domain : 'piaofang.wepiao.com' ,
3211 f2e : '127.0.0.1:8000' ,
@@ -48,37 +27,48 @@ const defaultConfig = {
4827 '/data/sk/101010100.html' : 'www.weather.com.cn:80' ,
4928 '2pmh9.free.natapp.cc' : '/ping' ,
5029 } ,
30+ // webpack externals
31+ externals : {
32+ react : 'React' ,
33+ 'react-dom' : 'ReactDOM' ,
34+ } ,
5135 } ,
5236}
5337
5438/* eslint-disable */
5539const customConfig = require ( `${ path . resolve ( process . cwd ( ) , 'config.js' ) } ` )
56- const extended = Object . assign ( { } , defaultConfig , customConfig )
40+ const extended = Object . assign ( { } , defaultConfig , customConfig || { } )
5741const config = {
5842 asset : {
59- path : getPath ( extended . asset . path ) ,
60- origin : extended . asset . path ,
43+ path : 'static/' ,
44+ src : {
45+ path : 'src/' ,
46+ js : 'src/static/js' ,
47+ img : 'src/static/img' ,
48+ view : 'src/template' ,
49+ } ,
50+ build : {
51+ path : 'static/build' ,
52+ img : 'static/build/img' ,
53+ view : 'view/build/' ,
54+ } ,
55+ dist : {
56+ path : 'static/dist' ,
57+ js : 'static/dist/js' ,
58+ css : 'static/dist/css' ,
59+ img : 'static/dist/img' ,
60+ view : 'view/dist/' ,
61+ } ,
6162 } ,
62- dev : extended . dev
63+ dev : extended . dev ,
6364}
6465
65- Object . keys ( extended . asset ) . map ( ( key ) => {
66- if ( key !== 'path' || key !== 'origin' ) {
67- Object . keys ( extended . asset [ key ] ) . map ( ( subKey ) => {
68- if ( ! config . asset [ key ] ) {
69- config . asset [ key ] = { }
70- }
71-
72- config . asset [ key ] [ subKey ] = getPath ( extended . asset [ key ] [ subKey ] )
73-
74- // webpack needs this original path
75- if ( key === 'build' && subKey === 'path' ) {
76- config . asset [ key ] . origin = extended . asset [ key ] [ subKey ]
77- }
66+ Object . keys ( config . asset ) . map ( ( key ) => {
67+ Object . keys ( config . asset [ key ] ) . map ( ( subKey ) => {
68+ config . asset [ key ] [ subKey ] = getPath ( config . asset [ key ] [ subKey ] )
7869
79- return subKey
80- } )
81- }
70+ return subKey
71+ } )
8272
8373 return key
8474} )
0 commit comments