Kibana development server up and running, but not picking up changes

Hi,

I have followed the instructions to setup a development environment for plugin development.
I also do see the first attempt (created by the create-plugin-script), but when I make a change to any of the files (public, server or common) the server does not pick them up.
Only when I manually stop en start (yarn start) the changes are reflected.

 $ node scripts/kibana --dev --run-examples
Marking config path as handled: dev
Marking config path as handled: plugins
Marking config path as handled: server
 no-base-path  ====================================================================================================
 no-base-path  Running Kibana in dev mode with --no-base-path disables several useful features and is not recommended
 no-base-path  ====================================================================================================
 watching for changes  (16221 files)
 restarting server  due to changes in "x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/event_log/get_execution_event_aggregation"
 restarting server  due to changes in
 - "x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/event_log/get_execution_event_aggregation/index.ts"
 - "x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/event_log/get_execution_event_aggregation/types.ts"
 np bld    log   [13:34:30.932] [info][@kbn/optimizer] initialized, 187 bundles cached
 np bld    log   [13:40:34.162] [info][@kbn/optimizer] starting worker [1 bundle]
[2023-01-16T13:38:21.927+01:00][INFO ][node] Kibana process configured with roles: [background_tasks, ui]
 np bld    log   [13:41:45.647] [success][@kbn/optimizer] 1 bundles compiled successfully after 710.8 sec, watching for changes
[2023-01-16T14:02:06.992+01:00][INFO ][plugins-service] Plugin "prebootExample" is disabled.
[2023-01-16T14:02:07.021+01:00][INFO ][plugins-service] Plugin "cloudChat" is disabled.
[2023-01-16T14:02:07.022+01:00][INFO ][plugins-service] Plugin "cloudExperiments" is disabled.
[2023-01-16T14:02:07.022+01:00][INFO ][plugins-service] Plugin "cloudFullStory" is disabled.
[2023-01-16T14:02:07.023+01:00][INFO ][plugins-service] Plugin "cloudGainsight" is disabled.
[2023-01-16T14:02:07.031+01:00][INFO ][plugins-service] Plugin "profiling" is disabled.
[2023-01-16T14:02:07.126+01:00][INFO ][http.server.Preboot] http server running at http://localhost:5601
[2023-01-16T14:02:07.310+01:00][INFO ][plugins-system.preboot] Setting up [1] plugins: [interactiveSetup]
[2023-01-16T14:02:07.373+01:00][WARN ][config.deprecation] The default mechanism for Reporting privileges will work differently in future versions, which will affect the behavior of this cluster. Set "xpack.reporting.roles.enabled" to "false" to adopt the future behavior before upgrading.
[2023-01-16T14:02:08.368+01:00][INFO ][plugins-system.standard] Setting up [142] plugins: [translations,monitoringCollection,licensing,globalSearch,globalSearchProviders,features,mapsEms,licenseApiGuard,customBranding,usageCollection,taskManager,cloud,guidedOnboarding,telemetryCollectionManager,telemetryCollectionXpack,kibanaUsageCollection,share,screenshotMode,banners,newsfeed,fieldFormats,expressions,screenshotting,dataViews,embeddable,uiActionsEnhanced,charts,esUiShared,customIntegrations,home,searchprofiler,painlessLab,grokdebugger,management,cloudDataMigration,advancedSettings,spaces,security,snapshotRestore,lists,encryptedSavedObjects,telemetry,licenseManagement,files,eventLog,actions,notifications,console,bfetch,data,watcher,reporting,fileUpload,ingestPipelines,alerting,unifiedSearch,myFirstHighLighterPlugin,unifiedFieldList,savedSearch,savedObjects,graph,savedObjectsTagging,savedObjectsManagement,presentationUtil,expressionShape,expressionRevealImage,expressionRepeatImage,expressionMetric,expressionImage,controls,eventAnnotation,dataViewFieldEditor,triggersActionsUi,transform,stackConnectors,stackAlerts,ruleRegistry,visualizations,canvas,visTypeXy,visTypeVislib,visTypeVega,visTypeTimeseries,visTypeTimelion,visTypeTagcloud,visTypeTable,visTypeMetric,visTypeHeatmap,visTypeMarkdown,dashboard,dashboardEnhanced,embeddableExamples,expressionXY,expressionTagcloud,expressionPartitionVis,visTypePie,expressionMetricVis,expressionLegacyMetricVis,expressionHeatmap,expressionGauge,lens,maps,cases,timelines,sessionView,kubernetesSecurity,threatIntelligence,aiops,discover,observability,fleet,osquery,indexManagement,rollup,remoteClusters,crossClusterReplication,indexLifecycleManagement,cloudSecurityPosture,discoverEnhanced,dataVisualizer,ml,synthetics,securitySolution,infra,upgradeAssistant,monitoring,logstash,enterpriseSearch,apm,visTypeGauge,dataViewManagement,thirdPartyVisLensExample,screenshottingExample,alertingExample,userProfileExamples,searchExamples,screenshotModeExample,routingExample,responseStream,filesExample,fieldFormatsExample,bfetchExplorer]

Hi @mpjjonker

just to clarify are your changes on the common/server side of your plugin, or in the public folder instead?

As for the former folders a server restart is required, but for the latter only a client side rebuild is done and you see only a line like this one:

np bld    log   [...] [success][@kbn/optimizer] N bundles compiled successfully after xxx.x sec, watching for changes

When changing a file content in a server/common folder will instead show something like this:

restarting server  due to changes ...
<lots of stuff in here>

Hi @Marco_Liberati , I have changed files in all locations. Nothing is being picked up.
the only time I see a watching for changes message is :

watching for changes  (16220 files)
 restarting server  due to changes in "x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/event_log/get_execution_event_aggregation"
 restarting server  due to changes in
 - "x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/event_log/get_execution_event_aggregation/types.ts"
 - "x-pack/plugins/security_solution/server/lib/detection_engine/rule_monitoring/logic/rule_execution_log/event_log/get_execution_event_aggregation/index.ts"

And it takes more than 10 minutes on my system before the servers takes a new request on http://localhost:5601/

In running this in WSL (Ubuntu) on Windows 11

The watching for changes message should appear only once at startup.
The two messages to look for are:

  • N bundles compiled successfully ... for client side changes ( anything in a public folder)
  • restarting server due to changes ... for server side changes ( anything in a server or common folder)

Ok thanks , this is in my logs (while I still can not get a response)

np bld    log   [14:40:33.727] [info][@kbn/optimizer] initialized, 187 bundles cached
 np bld    log   [14:46:31.463] [info][@kbn/optimizer] starting worker [1 bundle]
[2023-01-16T14:44:22.965+01:00][INFO ][node] Kibana process configured with roles: [background_tasks, ui]
 np bld    log   [14:47:33.778] [success][@kbn/optimizer] 1 bundles compiled successfully after 673.1 sec, watching for changes

notice the time difference (20 minutes !), maybe this WSL setup is not the best configuration for this type of development ? I must be doing something wrong

 np bld    log   [14:47:33.778] [success][@kbn/optimizer] 1 bundles compiled successfully after 673.1 sec, watching for changes
[2023-01-16T15:07:08.261+01:00][INFO ][plugins-service] Plugin "prebootExample" is disabled.

What version of the stack are you using?
Older versions used to have a long time for bundling, while last two major versions are way faster.

8.7.0