contentful.js icon indicating copy to clipboard operation
contentful.js copied to clipboard

Transpile into ECMAScript Module

Open gromovich opened this issue 2 years ago • 1 comments

Expected Behavior

Transpile contentful.js into ECMAScript module.

Actual Behavior

contentful.js is transpiled into CommonJS module.

Context

I'm using your library in an Angular project and it outputs warning when I try to build it:

Warning: contentful.ts depends on 'contentful'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

You can find more information here:

Configuring CommonJS dependencies

It is recommended that you avoid depending on CommonJS modules in your Angular applications. Depending on CommonJS modules can prevent bundlers and minifiers from optimizing your application, which results in larger bundle sizes. Instead, it is recommended that you use ECMAScript modules in your entire application.

How CommonJS is making your bundles larger

Environment

  • Package Version: 8.4.2

gromovich avatar Jul 16 '21 08:07 gromovich

Same thing to get this working with svelte kit https://github.com/sveltejs/kit/issues/928

Fedeorlandau avatar Sep 07 '21 18:09 Fedeorlandau

This ticket has been closed due to inactivity. If you still need help resolving your issue, please reach out through our community Slack, or contact Contentful support directly.

mayakarabula avatar Jun 13 '23 15:06 mayakarabula