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 11var configBase = require ( './webpack.config.base' ) ;
2+ var fs = require ( 'fs' ) ;
3+ const chalk = require ( 'chalk' ) ;
24//端名
35var libName = 'openlayers' ;
46//产品包名
@@ -11,6 +13,7 @@ if (origin && origin.includes('deploy-ol')) {
1113 libName = 'ol' ;
1214 productName = 'iclient-ol' ;
1315}
16+
1417var externals = [
1518 Object . assign ( { } , configBase . externals , {
1619 '@turf/turf' : 'function(){try{return turf}catch(e){return {}}}()' ,
@@ -32,6 +35,23 @@ var externals = [
3235 }
3336] ;
3437
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+
3555module . exports = {
3656 target : configBase . target ,
3757 mode : configBase . mode ,
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ L.GeoJSON.include({
128128 layer . defaultOptions = layer . options ;
129129 var defaultGeometryOptions = this . defaultGeometryOptions [ geometry . type ] ;
130130 if ( defaultGeometryOptions ) {
131- layer . commonOptions = defaultGeometryOptions ;
131+ layer . commonOptions = Object . assign ( { } , defaultGeometryOptions ) ;
132132 } else {
133133 this . defaultGeometryOptions [ geometry . type ] = L . Util . extend ( { } , layer . defaultOptions ) ;
134134 }
You can’t perform that action at this time.
0 commit comments