1.4.6 • Published 17 days ago

@hitachivantara/app-shell-vite-plugin v1.4.6

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
17 days ago

@hitachivantara/app-shell-vite-plugin

Hitachi Vantara App Shell Vite Plugin: Streamlines development and build processes for App Shell.

Overview

The @hitachivantara/app-shell-vite-plugin enhances the App Shell experience by automating essential development and build tasks, such as processing configurations, creating virtual endpoints, and managing importmaps and base paths.

This plugin is responsible for the hard lifting during development time and build time. It performs the following actions:

  • copy all the required js bundles to the final "bundles" folders;
  • process the app-shell.config.ts file;
  • create virtual endpoints to support dev mode;
  • create virtual main.tsx and App.tsx files. These files are there strictly for development purposes, as what ultimately matters are the ESM modules exported and consumed by others;
  • create importmap and inject it into index.html;
  • create <base href="..."> tag and inject it into index.html.

How to use

Install the plugin:

npm install -D @hitachivantara/app-shell-vite-plugin

Add the plugin to the vite plugin list in vite.config.ts.

// imports omitted
import { HvAppShellVitePlugin } from "@hitachivantara/app-shell-vite-plugin";

export default defineConfig(({ mode }) => {
  return {
    plugins: [
      // other plugins omitted
      HvAppShellVitePlugin({ mode })
    ],
  };
});

app-shell.config

The configuration file must be placed at the root directory of the app and the vite-plugin can process the app-shell.config as a JSON or Typescript extension.

Managing settings in TypeScript however provides more efficiency and type safety features. You can check this configuration in action here.

Configuration properties

  • modules: all modules that an application wants, and needs, to export so that they can be consumed by either App Shell or any other applications.
  • type: controls the way application build process is executed. By using the app option, the build process will generate the complete set of final files ( index.html, assets, etc). Using the bundle option, will only create the final files for the entries defined at the modules property. app value is typically recommended for the scenarios where App Shell is used at standalone scenarios, and bundle for microservices environments. By default, type value is set to app at local development, but it will change to bundle value at CI environments (relying at the standard env property that normally available at these environments). To use app , value needs to be explicitly set at vite.config file.

Automatic features

  • autoViewsAndRoutes: automatically exports views from the src/pages directory (or any other specified folder defined in the viewsFolder property). This includes automatic route configuration (merges with existing ones, if any). The resulting views will be added automatically to views defined at the configuration file (associated bundle will also be added to the final modules list)
  • autoMenu: creates a navigation menu derived from the views. This ensures a more organized and streamlined development process.

Empty Configuration Validity: With these automatic features in place, the configuration file isn't even mandatory for dev environments.

<base href="..."> tag

The tag is automatically injected at index.html file during the build process and its value will be the same as the value in the baseUrl property of the App Shell configuration file.

1.4.6

17 days ago

1.4.5

17 days ago

1.4.4

23 days ago

1.4.3

1 month ago

1.4.2

1 month ago

1.4.1

2 months ago

1.4.0

2 months ago

1.3.3

3 months ago

1.3.2

3 months ago

1.3.1

3 months ago

1.2.0

3 months ago

1.1.0

3 months ago

1.3.0

3 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.18.9

4 months ago

0.18.8

4 months ago

0.18.7

4 months ago

0.18.5

4 months ago

0.18.6

4 months ago

0.18.4

4 months ago

0.18.2

4 months ago

0.18.3

4 months ago

0.18.1

4 months ago

0.18.0

5 months ago

0.17.11

5 months ago

0.17.3

8 months ago

0.17.4

8 months ago

0.17.5

7 months ago

0.17.6

7 months ago

0.17.7

7 months ago

0.17.8

7 months ago

0.17.9

6 months ago

0.11.0

9 months ago

0.10.1

9 months ago

0.12.0

9 months ago

0.11.1

9 months ago

0.10.2

9 months ago

0.13.0

9 months ago

0.12.1

9 months ago

0.11.2

9 months ago

0.14.0

8 months ago

0.15.0

8 months ago

0.14.1

8 months ago

0.16.0

8 months ago

0.15.1

8 months ago

0.17.0

8 months ago

0.16.1

8 months ago

0.17.1

8 months ago

0.16.2

8 months ago

0.17.10

6 months ago

0.10.0

9 months ago

0.9.0

10 months ago

0.9.2

9 months ago

0.9.1

9 months ago

0.8.2

10 months ago

0.8.1

10 months ago

0.7.2

11 months ago

0.8.0

11 months ago

0.7.1

11 months ago

0.6.2

12 months ago

0.7.0

11 months ago

0.6.1

12 months ago

0.6.0

12 months ago

0.5.1

1 year ago