Top Menu

Jump to content
    Global modules

    Global modules

    • Home
    • Projects
    • Activity
    • Work packages
    • Gantt charts
    • Calendars
    • Team planners
    • Boards
    • News
    Home
    Home
Help
    Getting started
    • Introduction video
  • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support
  • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation

User menu

Sign in
Forgot your password?

or sign in with your existing account

OpenProject ID Google

Side Menu

Collapse project menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Expand project menu
Development
  1. OpenProject Community
  2. OpenProject
  3. Forums
  4. Development
  5. Webpack: Non-Angular js/ts files in plugins

Webpack: Non-Angular js/ts files in plugins

Added by Niclas UNIBE over 1 year ago

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 {}

Loading...