Open link in a new tab

Content

Expand project menu

Webpack: Non-Angular js/ts files in plugins

I would like the webpack to serve ts files defined in my plugin.
These files are not part of an angular app, I use them for stimulus.

The only solution I found so far was to create a "fake" angular app by creating a file frontend/module/main.ts in my plugin.
This gets linked and imported when executing  ./bin/rake openproject:plugins:register_frontend.

This is not a very nice solution and I was wondering if there is a better way to tell webpack about my js/ts files.

Thats the main.ts I'm currently using.

import {
  Injector,
  NgModule,
} from '@angular/core';

// Do custom imports here
// (I think you might actually need to "use" the imported objects in this file, otherwise they are considered "unused" and not served by webpack)

@NgModule({})
export class PluginModule {}