grgrzybek commented on PR #109:
URL: 
https://github.com/apache/activemq-artemis-console/pull/109#issuecomment-3135931424

   Actually it's not about rm-rfing `node_modules`. When working on 
dependencies/devDependencies/peerDependencies I used some hacks to verify if 
the bundlers are properly configured.
   
   We have (here and in Hawtio too) two bundlers:
   * tsup (esbuild + rollup) for _libraries_
   * webpack for _apps_
   
   The point is to not let duplicate code to sneak in anywhere.
   
   For this purpose I check `tsup` produced file by filtering the bundle by 
`^//` - it should _never_ contain any node_modules references. Here I see:
   ```
   $ pwd
   
/home/ggrzybek/sources/github.com/apache/activemq-artemis-console/artemis-console-extension/artemis-extension/packages/artemis-console-plugin
   ✔ 
~/sources/github.com/apache/activemq-artemis-console/artemis-console-extension/artemis-extension/packages/artemis-console-plugin
 [ggrzybek-console-fixes L|✚ 1] 
   13:38 $ grep '^//' dist/index.js
   // src/globals.ts
   // src/util/jmx.ts
   // src/config-manager.ts
   // src/artemis-service.ts
   // src/artemis-preferences-service.ts
   // src/table/ArtemisTable.tsx
   // src/producers/ProducerTable.tsx
   // src/consumers/ConsumerTable.tsx
   // src/connections/ConnectionsTable.tsx
   // src/sessions/SessionsTable.tsx
   // src/queues/CreateQueue.tsx
   // src/context.ts
   // src/addresses/CreateAddress.tsx
   // 
../../node_modules/@monaco-editor/loader/lib/es/_virtual/_rollupPluginBabelHelpers.js
   // ../../node_modules/state-local/lib/es/state-local.js
   // ../../node_modules/@monaco-editor/loader/lib/es/config/index.js
   // ../../node_modules/@monaco-editor/loader/lib/es/utils/curry.js
   // ../../node_modules/@monaco-editor/loader/lib/es/utils/isObject.js
   // ../../node_modules/@monaco-editor/loader/lib/es/validators/index.js
   // ../../node_modules/@monaco-editor/loader/lib/es/utils/compose.js
   // ../../node_modules/@monaco-editor/loader/lib/es/utils/deepMerge.js
   // ../../node_modules/@monaco-editor/loader/lib/es/utils/makeCancelable.js
   // ../../node_modules/@monaco-editor/loader/lib/es/loader/index.js
   // ../../node_modules/@monaco-editor/loader/lib/es/index.js
   // ../../node_modules/@monaco-editor/react/dist/index.mjs
   // src/messages/SendMessage.tsx
   // src/addresses/AddressesTable.tsx
   // src/status/Status.tsx
   // src/queues/QueuesTable.tsx
   // src/messages/QueueSelect.tsx
   // src/messages/MessagesTable.tsx
   // src/messages/MessageView.tsx
   // src/queues/QueuesView.tsx
   // src/brokers/BrokerDiagram.tsx
   // src/views/ArtemisTabView.tsx
   // src/Artemis.tsx
   // src/ArtemisTreeView.css
   // src/ArtemisTreeView.tsx
   // src/artemisJMX.css
   // src/ArtemisJMXContent.css
   // src/addresses/DeleteAddress.tsx
   // src/queues/DeleteQueue.tsx
   // src/views/ArtemisJMXTabView.tsx
   // src/ArtemisJMXContent.tsx
   // src/ArtemisJMX.tsx
   // src/ArtemisPreferences.tsx
   // src/ArtemisHeader.tsx
   // src/plugin-ui.ts
   // src/index.ts
   // src/help.md
   // src/index.ts
   // Annotate the CommonJS export names for ESM import in node:
   //# sourceMappingURL=index.js.map
   ```
   
   which means that `tsup` didn't find:
   * @monaco-editor/loader
   * @monaco-editor/react
   * state-local
   
   modules among dependencies, so `tsup` simply put the source into target 
bundle.
   
   For webpack it's a bit more complicated, as we have chunks etc. But I simply 
open the files in Gvim and do `:v/!\*\*\*.*node_modules/d` which gives me 
something like:
   ```
     !*** ../node_modules/@babel/runtime/helpers/esm/extends.js ***!
     !*** ../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***!
     !*** 
../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***!
     !*** ../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***!
     !*** ../node_modules/d3-axis/src/axis.js ***!
     !*** ../node_modules/d3-axis/src/identity.js ***!
     !*** ../node_modules/d3-axis/src/index.js ***!
     !*** ../node_modules/d3-brush/src/brush.js ***!
     !*** ../node_modules/d3-brush/src/constant.js ***!
     ...
     (2405 lines like this)
   ```
   
   Mind that this is the final bundle and it should contain everything - 
including `node_modules` references. But these cryptic "module names" are 
related to how Webpack works. Here I check if there are no weird 
`../../../../../node_modules` which may be (but doesn't have to be) a sign that 
there's something wrong.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to