Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apollo-boost uses commonjs module imports instead of es2015 #3824

Closed
RumataEstor opened this issue Aug 17, 2018 · 3 comments
Closed

Apollo-boost uses commonjs module imports instead of es2015 #3824

RumataEstor opened this issue Aug 17, 2018 · 3 comments

Comments

@RumataEstor
Copy link

I was trying to optimise bundling of an application built using apollo-boost, removed all the runtime dependencies on graphql library but the bundle would still contain the library.

Intended outcome:

Webpack to tree-shake graphql-tag and graphql in an application using apollo-boost but not using gql.

Actual outcome:

Full graphql library is still bundled because of

[47] ./node_modules/graphql-tag/src/index.js 5.13 KiB {1} [built]
     cjs require graphql-tag [24] ./node_modules/apollo-boost/lib/index.js 34:20-42
// node_modules/apollo-boost/lib/index.js:34
var graphql_tag_1 = require("graphql-tag");
exports.gql = graphql_tag_1.default;

This is happening because https://github.com/apollographql/apollo-client/blob/master/packages/apollo-boost/tsconfig.json uses

"module": "commonjs",

However the rest of the packages in the repository use

"extends": "../../tsconfig.base",

That contains

"module": "es2015"

How to reproduce the issue:
Doesn't require reproducing.

Versions

  System:
    OS: Linux 4.14 NixOS 18.09pre149044.6afd19e699c (Jellyfish) 18.09pre149044.6afd19e699c (Jellyfish)
  Binaries:
    Node: 8.11.3 - ~/.nix-profile/bin/node
    Yarn: 1.9.4 - ~/.nix-profile/bin/yarn
    npm: 5.6.0 - ~/.nix-profile/bin/npm
  npmPackages:
    apollo-boost: ^0.1.13 => 0.1.13
@hwillson
Copy link
Member

This is being worked on in #3817. We should have that PR merged shortly. Thanks!

@RumataEstor
Copy link
Author

@hwillson Cool! Thanks for the great work!

@JacksonKearl
Copy link

This should have been closed with #3817.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants