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

Rollup is not including GraphQLServer #659

Closed
dinesh-here opened this issue Dec 6, 2020 · 1 comment
Closed

Rollup is not including GraphQLServer #659

dinesh-here opened this issue Dec 6, 2020 · 1 comment

Comments

@dinesh-here
Copy link

dinesh-here commented Dec 6, 2020

Hi All,

I am trying to create bundle for my graphql-yoga simple application to make production ready and check but it says

image

Here is my rollup.config file

import filesize from 'rollup-plugin-filesize';
import {terser} from 'rollup-plugin-terser';
import resolve from 'rollup-plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from "@rollup/plugin-commonjs";
import json from '@rollup/plugin-json';
import builtins from '@crokita/rollup-plugin-node-builtins';
import globals from '@crokita/rollup-plugin-node-globals';
export default {
  input: ['dist/index.js'],
  output: {
    file: 'finapp.js',
    format: 'iife',
    name: 'MyModule'
  },
  onwarn(warning) {
    if (warning.code !== 'THIS_IS_UNDEFINED') {
      console.error(`(!) ${warning.message}`);
    }
  },
  plugins: [
    builtins(),
    globals(),
    replace({'Reflect.decorate': 'undefined'}),
    commonjs({
      include: /node_modules/,
      extensions: ['.mjs', '.js', '.json'],
      namedExports: {
        'node_modules\graphql-yoga\dist\index.js': [ 'GraphQLServer' ]
      },
      ignoreGlobal: false, // Default: false
      sourceMap: false // Default: true
    }),   
   resolve({extensions: ['.mjs', '.js', '.json']}),
    nodeResolve({ extensions: ['.mjs', '.js', '.json'], moduleDirectories:[] }),
    terser({
      module: true,
      warnings: true,
      mangle: {
        properties: {
          regex: /^__/,
        },
      },
    }),
    json(),
    filesize({
      showBrotliSize: true,
    }),
  ],
};

Here is deps

"devDependencies": {
      "@rollup/plugin-commonjs": "^17.0.0",
      "@rollup/plugin-json": "^4.1.0",
      "@rollup/plugin-node-resolve": "*",
      "@rollup/plugin-replace": "^2.3.1",
      "@types/node": "^8.0.29",
      "nodemon": "^2.0.2",
      "rollup": "^1.32.1",
      "rollup-plugin-filesize": "^7.0.0",
      "rollup-plugin-node-resolve": "^5.2.0",
      "@crokita/rollup-plugin-node-builtins": "*",
      "@crokita/rollup-plugin-node-globals": "*",
      "rollup-plugin-terser": "^5.3.0",
      "ts-node": "3.3.0",
      "typescript": "3.3.3333"
   },
   "dependencies": {
      "typeorm": "0.2.24",
      "reflect-metadata": "^0.1.10",
      "graphql-yoga": "1.18.3",
      "moment": "*",
      "pg": "^7.3.0",
      "jsonwebtoken": "*",
      "read-excel-file": "*",
      "cookie-parser": "*"
   }

Few of them suggested to include namedExports but it's deprecated now in @rollup/plugin-commonjs
Did anyone tried bundle with rollup/webpack? Please share the config if available

Thanks!

@saihaj saihaj mentioned this issue Dec 5, 2021
32 tasks
@Urigo
Copy link
Collaborator

Urigo commented Mar 29, 2022

Hey, @Urigo from The Guild here!

You might know us from projects such as graphql-code-generator, envelop or graphql-tools.

For a long time we thought that the Javascript ecosystem is still missing a lightweight cross-platform, but still highly customizable GraphQL Server.

In the past the awesome Prisma team took on that great challenge and now we are happy to announce that we are continuing them and just released GraphQL Yoga 2.0 - Build fast, extensible, and batteries-included (Subscriptions, Serverless, File uploads support) GraphQL APIs in Node.js 🚀

And regarding the issue here, Yoga can be bundled with any solution, if you have issues with the new version, please let us know!

We have been working a long time on version 2.0 and have been using it in our clients projects for a few months now and shared a couple of alpha cycles here.
Thank you all for your feedback and suggestions, you made this release possible!

Please try Yoga out again, give us feedback and help us spread the word on the new release!

@Urigo Urigo closed this as completed Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants