Stencil v3.4.0 is now available! This was a smaller release as the team has been focusing efforts on the upcoming Stencil v4 release, but does introduce one new feature for validating core fields used when publishing your Stencil component libraries. Let’s take a look!

Primary Package Output Target Validation

In Stencil v3.4.0 we’re changing how the Stencil compiler validates fields in your project’s package.json that have recommended values based on certain Stencil output target types. Historically, the output target to validate against has been controlled by Stencil itself. Moving forward, developers will be able to designate a specific output target to use for this validation.

Taking advantage of this new behavior is straightforward and only requires you to set two flags in your Stencil configuration. Firstly, you’ll need to opt in to the validation logic by enabling the validatePrimaryPackageOutputTarget flag in the root of your config:

import { Config } from '@stencil/core';

export const config: Config = {
  validatePrimaryPackageOutputTarget: true,
  // ...
};

Then, simply set the isPrimaryPackageOututTarget flag on the output target you would like to validate (the list of valid output target types can be found in the Stencil docs):

import { Config } from '@stencil/core';

export const config: Config = {
  validatePrimaryPackageOutputTarget: true,
  outputTargets: [
    {
      type: ‘dist’,
      isPrimaryPackageOutputTarget: true,
      // ...
    }
  ]
  // ...
};

That’s it! Stencil will handle the rest based on your output target configuration and you’ll see warnings logged to the console at build time if it detects a problem with your configuration or the values in your package.json don’t match the recommended values.

For more information on this feature, check out the related Stencil docs.

But wait, there’s more!

This release of Stencil includes additional internal updates and dependency version bumps. For a full list of changes, please take a look at the changelog for this release. 

The post Announcing Stencil v3.4.0 appeared first on Ionic Blog.

Read more

© 2024 Extly, CB - All rights reserved.