You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contentful package should be available as ES modules.
Any objects imported from contentful should not throw a warning when building in Angular CLI.
Actual Behavior
When createClient is used, the Angular CLI throws a warning during build / start commands.
import { createClient } from 'contentful';
// or
import * as contentful from 'contentful';
warning from angular cli build (this is when installing contentful on a local angular library, imported by the app being built and started):
Warning: ...\dist\lib1\fesm2022\lib1.mjs depends on 'contentful'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Possible Workaround
Add contentful on angular.json's allowedCommonJsDependencies
Steps to Reproduce
Create a workspace with a library and app using Angular CLI
Install contentful, use it within the library.
Initialize a contentful client using createClient from contentful, regardless of its configuration, inside a component's constructor.
then add the component to the app such that it gets rendered in the starting page.
build and run the app
Context
ESM modules is now the recommended approach instead of CommonJs
Environment
Language Version: node v16.19.0
Package Manager Version: npm 8.19.3
Package Version: contentful 10.6.16
The text was updated successfully, but these errors were encountered:
Expected Behavior
Contentful package should be available as ES modules.
Any objects imported from contentful should not throw a warning when building in Angular CLI.
Actual Behavior
When
createClient
is used, the Angular CLI throws a warning during build / start commands.warning from angular cli build (this is when installing contentful on a local angular library, imported by the app being built and started):
Possible Workaround
Add
contentful
on angular.json'sallowedCommonJsDependencies
Steps to Reproduce
createClient
fromcontentful
, regardless of its configuration, inside a component's constructor.Context
ESM modules is now the recommended approach instead of CommonJs
Environment
The text was updated successfully, but these errors were encountered: