File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
var configBase = require ( './webpack.config.base' ) ;
2
+ var fs = require ( 'fs' ) ;
3
+ const chalk = require ( 'chalk' ) ;
2
4
//端名
3
5
var libName = 'openlayers' ;
4
6
//产品包名
@@ -11,6 +13,7 @@ if (origin && origin.includes('deploy-ol')) {
11
13
libName = 'ol' ;
12
14
productName = 'iclient-ol' ;
13
15
}
16
+
14
17
var externals = [
15
18
Object . assign ( { } , configBase . externals , {
16
19
'@turf/turf' : 'function(){try{return turf}catch(e){return {}}}()' ,
@@ -32,6 +35,23 @@ var externals = [
32
35
}
33
36
] ;
34
37
38
+ var methodNames = [ 'bindFeaturesCollection_' , 'addFeaturesInternal' ] ;
39
+ checkPrivateMethodExists ( methodNames ) ;
40
+
41
+ function checkPrivateMethodExists ( methodNames ) {
42
+ const file_path = 'node_modules/ol/dist/ol.js' ;
43
+ try {
44
+ const data = fs . readFileSync ( file_path , 'utf8' ) ;
45
+ methodNames . forEach ( ( methodName ) => {
46
+ if ( ! data . includes ( methodName ) ) {
47
+ console . log ( chalk . red ( `方法 ${ methodName } 不存在于混淆后的 ol 中 ${ file_path } ,测试 ol fgb 重写方法是否被调用` ) ) ;
48
+ }
49
+ } ) ;
50
+ } catch ( err ) {
51
+ console . error ( '读取文件出错:' , err ) ;
52
+ }
53
+ }
54
+
35
55
module . exports = {
36
56
target : configBase . target ,
37
57
mode : configBase . mode ,
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ L.GeoJSON.include({
128
128
layer . defaultOptions = layer . options ;
129
129
var defaultGeometryOptions = this . defaultGeometryOptions [ geometry . type ] ;
130
130
if ( defaultGeometryOptions ) {
131
- layer . commonOptions = defaultGeometryOptions ;
131
+ layer . commonOptions = Object . assign ( { } , defaultGeometryOptions ) ;
132
132
} else {
133
133
this . defaultGeometryOptions [ geometry . type ] = L . Util . extend ( { } , layer . defaultOptions ) ;
134
134
}
You can’t perform that action at this time.
0 commit comments