@custom-elements-manifest/analyzer Config

We support custom-elements-manifest.config.mjs used by @custom-elements-manifest/analyzer to generate a Custom Elements Manifest file.

More information about our Custom Elements Manifest support and how to run the analyzer here.

Configuration Options

Our integration of @custom-elements-manifest/analyzer uses the browser version and supports the options described in the official docs, but with a few exceptions:

  • watch and overrideModuleCreation are not supported
  • plugins are supported, but you can import them only from absolute URLs (more on this below)

You can omit the file and rely on the default configuration. The defaults are consistent with the CLI provided by @custom-elements-manifest/analyzer and can be represented by the following file:

// custom-elements-manifest.config.mjs
export default {
  globs: ['**/*.{js,ts,tsx}'],
  exclude: [],
  outdir: '',
  dev: false,
  litelement: false,
  fast: false,
  stencil: false,
  catalyst: false,
  plugins: [],
};

Create your own custom-elements-manifest.config.mjs file to change the defaults. You can omit certain properties to fallback on defaults and specify only what's needed, e.g.:

// custom-elements-manifest.config.mjs
export default {
  exclude: ['**/*.spec.ts'],
  stencil: true,
};

Importing Plugins

You can import plugins from absolute URLs (e.g. using CDNs) and then add them to plugins.

This is an example showing how to import and configure cem-plugin-module-file-extensions.

// custom-elements-manifest.config.mjs
import { moduleFileExtensionsPlugin } from 'https://cdn.jsdelivr.net/npm/cem-plugin-module-file-extensions@0.0.2';
export default {
  globs: ['src/**/*.ts'],
  litelement: true,
  plugins: [moduleFileExtensionsPlugin()],
};

References