How to remove the 'src' folder in 'node_modules/@theia/*' of theia-blueprint packaged version

Hello:

We found that the unpacked version of Theia-blueprint still kept Theia’s source code in its resources/app/node_module/@theia/*, which would leak the source code and increase the size of application:

tptuser@linux-3:/work/ide/theia-blueprint/applications/electron/dist/linux-unpacked/resources/app/node_modules/@theia$ ls */src/*
application-package/src/api.ts                          external-terminal/src/package.spec.ts      node-pty/src/types.ts                 plugin-ext/src/plugin-ext-backend-electron-module.ts
application-package/src/application-package.spec.ts     getting-started/src/package.spec.ts        node-pty/src/unixTerminal.test.ts     plugin-ext/src/plugin-ext-backend-module.ts
application-package/src/application-package.ts          keymaps/src/package.spec.ts                node-pty/src/unixTerminal.ts          plugin-ext/src/plugin-ext-frontend-electron-module.ts
application-package/src/application-props.ts            mini-browser/src/package.spec.ts           node-pty/src/utils.ts                 plugin-ext/src/plugin-ext-frontend-module.ts
application-package/src/environment.ts                  monaco/src/package.spec.ts                 node-pty/src/windowsPtyAgent.test.ts  plugin/src/package.spec.ts
application-package/src/extension-package-collector.ts  navigator/src/package.spec.ts              node-pty/src/windowsPtyAgent.ts       property-view/src/package.spec.ts
application-package/src/extension-package.ts            node-pty/src/conpty_console_list_agent.ts  node-pty/src/windowsTerminal.test.ts  terminal/src/package.spec.ts
application-package/src/index.ts                        node-pty/src/eventEmitter2.test.ts         node-pty/src/windowsTerminal.ts       timeline/src/package.spec.ts
application-package/src/json-file.ts                    node-pty/src/eventEmitter2.ts              outline-view/src/package.spec.ts      typehierarchy/src/package.spec.ts
application-package/src/npm-registry.ts                 node-pty/src/index.ts                      ovsx-client/src/index.ts              userstorage/src/package.spec.ts
callhierarchy/src/package.spec.ts                       node-pty/src/interfaces.ts                 ovsx-client/src/ovsx-client.spec.ts   vsx-registry/src/package.spec.ts
console/src/package.spec.ts                             node-pty/src/terminal.test.ts              ovsx-client/src/ovsx-client.ts
editor-preview/src/package.spec.ts                      node-pty/src/terminal.ts                   ovsx-client/src/ovsx-types.ts
editor/src/package.spec.ts                              node-pty/src/testUtils.test.ts             plugin-dev/src/package.spec.ts

bulk-edit/src/browser:
bulk-edit-commands.ts  bulk-edit-contribution.ts  bulk-edit-frontend-module.ts  bulk-edit-tree  bulk-edit-tree-label-provider.ts  style

callhierarchy/src/browser:
callhierarchy-contribution.ts  callhierarchy-frontend-module.ts  callhierarchy-service.ts  callhierarchy-tree  callhierarchy.ts  current-editor-access.ts  index.ts  style  utils.ts

callhierarchy/src/common:
glob.ts  language-selector.ts  paths.ts

console/src/browser:
ansi-console-item.tsx       console-contribution.ts     console-history.ts              console-manager.ts          console-session.ts  style
console-content-widget.tsx  console-frontend-module.ts  console-keybinding-contexts.ts  console-session-manager.ts  console-widget.ts

core/src/browser:
about-dialog.tsx                   dialogs                                       icons                      navigatable.ts                     storage-service.spec.ts
authentication-service.ts          dialogs.ts                                    index.ts                   nls-loader.ts                      storage-service.ts
breadcrumbs                        diff-uris.ts                                  json-schema-store.ts       opener-service.spec.ts             style
browser-clipboard-service.ts       encoding-registry.ts                          keybinding.spec.ts         opener-service.ts                  supported-encodings.ts
browser.ts                         endpoint.spec.ts                              keybinding.ts              preferences                        test
clipboard-service.ts               endpoint.ts                                   keyboard                   progress-bar-factory.ts            theming.ts
color-application-contribution.ts  external-uri-service.ts                       keys.ts                    progress-bar.ts                    tooltip-service.tsx
color-registry.ts                  frontend-application-bindings.ts              label-parser.spec.ts       progress-client.ts                 tree
command-open-handler.ts            frontend-application-config-provider.spec.ts  label-parser.ts            progress-location-service.spec.ts  view-container.ts
common-frontend-contribution.ts    frontend-application-config-provider.ts       label-provider.spec.ts     progress-location-service.ts       widget-decoration.ts
connection-status-service.spec.ts  frontend-application-module.ts                label-provider.ts          progress-status-bar-item.ts        widget-manager.spec.ts
connection-status-service.ts       frontend-application-state.ts                 language-service.ts        quick-input                        widget-manager.ts
context-key-service.ts             frontend-application.ts                       logger-frontend-module.ts  resource-context-key.ts            widget-open-handler.ts
context-menu-renderer.ts           http-open-handler.ts                          menu                       saveable.ts                        widgets
core-preferences.ts                i18n                                          messaging                  shell                              window
credentials-service.ts             icon-theme-contribution.ts                    mime-service.ts            source-tree                        window-contribution.ts
decorations-service.ts             icon-theme-service.ts                         navigatable-types.ts       status-bar
...

Is there any way to let electron-builder to remove the src folder?

Another question: If we let electron-builder to remove the src folder for each theia module in node_module/@theia, the style file imports would have trouble because the src folder is no longer in the packaged version

# packages/core/src/browser/frontend-application-module.ts

import '../../src/browser/style/index.css';
require('../../src/browser/style/materialcolors.css').use();
import 'font-awesome/css/font-awesome.min.css';
import 'file-icons-js/css/style.css';
import '@vscode/codicons/dist/codicon.css';

// ...

Is there any way to copy style files from src to lib so that we could import it using: import './style/index.css' ?

Really appreciate :smiley:

The question was also asked on discussions so closing this issue: