Graphql-tag: Implement ES6 export file

Created on 29 Jun 2020  路  5Comments  路  Source: apollographql/graphql-tag

Angular worked on the build process in v10 and removed support for already transpiled code to ES5 for Angular Libraries. Also they now show a warning for every dependency that is imported in ES5.

More information:
https://angular.io/guide/build#configuring-commonjs-dependencies

Example warning:

WARNING in P:\XXX\XXX.js depends on graphql-tag. CommonJS or AMD
 dependencies can cause optimization bailouts.

To avoid this we'd need an ES6 file in "main" property of package.json or at least a file in the lib folder in ES6 that can be imported directly. This should be the feature request of this issue.

Most helpful comment

It's 2021 and I am still see this warning? along with another for Observable.

I am using Apollo for Angular.

Warning: /home/ ... /node_modules/@apollo/client/core/index.js depends on 'graphql-tag'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/ ... /node_modules/@apollo/client/utilities/observables/Observable.js depends on 'zen-observable'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

All 5 comments

Seems like #273 should fix this although it's an old PR.

@MatthiasKunnen
Any updates for this?

@nikita-lobkov, you should check the linked PRs for progress. None of these are mine so I'm afraid I can't give you an update.

on Angular v10 to remove all warnings:

File angular.json

"architect": {
        "build": {
            "options": {
                 "allowedCommonJsDependencies": [
                     "graphql-tag",
                     "zen-observable"
                 ]
            }
         }
}

It's 2021 and I am still see this warning? along with another for Observable.

I am using Apollo for Angular.

Warning: /home/ ... /node_modules/@apollo/client/core/index.js depends on 'graphql-tag'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: /home/ ... /node_modules/@apollo/client/utilities/observables/Observable.js depends on 'zen-observable'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jnwng picture jnwng  路  10Comments

jnwng picture jnwng  路  7Comments

ianstormtaylor picture ianstormtaylor  路  6Comments

matheusrocha89 picture matheusrocha89  路  6Comments

felixfbecker picture felixfbecker  路  6Comments