Skip to content

UI5 Tooling task for filtering debug files from the build bundle

License

Notifications You must be signed in to change notification settings

dfenerski/ui5-task-no-debug-files

Repository files navigation

Intro

The UI5 tooling V3 always generates -dbg.js & .js.map files, with no option to remove them. While helpful for debugging purposes, this behavior is sometimes undesirable.

Unfortunately the tooling has no native support for disabling this. However ui5-task-no-debug-files plugs this gap. By installing this task, your final bundles will only contain the files you want.

Installation

Prerequisites

Setup

  1. Start by installing the task as devDependency
npm install ui5-task-no-debug-files --save-dev
  1. Enable the task in your project's ui5.yaml
builder:
    customTasks:
        - name: ui5-task-no-debug-files
          afterTask: generateComponentPreload

Configuration Options

The task has a couple of options available which determine which files get omitted. Tweak those to achieve desired build output.

  • omitDbgFiles - whether to filter -dbg.js files from the output. Defaults to true
  • omitSourceMapFiles - whether to filter .js.map files from the output. Defaults to true
  • omitTSFiles - whether to filter .ts files from the output. Useful when developing in TypeScript setup. Defaults to true
  • omitNonBundled - whether to filter the original .js/.xml files from the output. Defaults to true
  • omitDirs - Additional directories to be filtered out from the build output. Defaults to ['test', 'i18n']
  • preserveNonBundled - List of glob patterns to be explicitly kept in the output. Useful when a self-contained build fails to bundle everything (e.g. it does not bundle lazy loaded fragments)

Examples

Keep everything
builder:
    customTasks:
        - name: ui5-tooling-transpile-task
          afterTask: replaceVersion
        - name: ui5-task-no-debug-files
          afterTask: generateComponentPreload
          configuration:
              omitDbgFiles: false
              omitSourceMapFiles: false
              omitNonBundled: false
              omitTSFiles: false
              omitDirs: []
Keep i18n.properties & xml files
builder:
    customTasks:
        - name: ui5-tooling-transpile-task
          afterTask: replaceVersion
        - name: ui5-task-no-debug-files
          afterTask: generateLibraryPreload
          configuration:
              omitDirs: []
              preserveNonBundled: ['**/*.xml']

Build modes

  • When building libraries, ui5-task-no-debug-files should run after generateLibraryPreload
  • When building applications, ui5-task-no-debug-files should run
    • after generateComponentPreload if build is not self-contained
    • after generateStandaloneAppBundle if build is self-contained

License

This work is licensed under Apache 2.0.

About

UI5 Tooling task for filtering debug files from the build bundle

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published