Giter VIP home page Giter VIP logo

Comments (12)

ije avatar ije commented on May 14, 2024 2
import * as Request from "https://esm.sh/graphql-request";
console.log(Request);

i got the output:

Module {
  ClientError: undefined,
  GraphQLClient: undefined,
  default: [Function: Pe],
  gql: undefined,
  rawRequest: undefined,
  request: undefined,
  [Symbol(Symbol.toStringTag)]: "Module"
}

seems it is the esbuild issue, i'm not sure what happened, will check the esbuild api later, thanks @FallingSnow

from esm.sh.

shadowtime2000 avatar shadowtime2000 commented on May 14, 2024 1

The skypack example you gave doesn't seem to run properly
image
The fact that it is importing /language/printer instead of /language/printer.js is a little strange...

from esm.sh.

ije avatar ije commented on May 14, 2024 1

fixed

from esm.sh.

shadowtime2000 avatar shadowtime2000 commented on May 14, 2024

I was looking through the bundle (yes I know it's not that good of a thing to do) but it seems Bt is never defined. bt is but JavaScript references are case sensitive I believe. Could that be the case?

from esm.sh.

FallingSnow avatar FallingSnow commented on May 14, 2024

Ok... oddly enough this does work though.

import {graphql} from "https://cdn.skypack.dev/graphql";
import request, {gql} from "https://cdn.skypack.dev/graphql-request";
console.log(graphql, gql);

I can upload a test repo if you'd like.

from esm.sh.

FallingSnow avatar FallingSnow commented on May 14, 2024

Ok you're right. In fact none of the others are defined either (At, _t, Ft, jt)...

from esm.sh.

FallingSnow avatar FallingSnow commented on May 14, 2024

I guess what's next is to try a local esbuild example.

from esm.sh.

FallingSnow avatar FallingSnow commented on May 14, 2024

Local esbuild does work correctly.

app.ts

import {gql} from "graphql-request";
console.log(gql);
$ yarn add esbuild graphql-request
$ ./node_modules/.bin/esbuild app.ts --bundle --platform=node --outfile=out.js
$ node out.js
[Function: gql2]

from esm.sh.

shadowtime2000 avatar shadowtime2000 commented on May 14, 2024

Yeah, seems to be a problem with the esbuild minifier. We should probably file a bug report there

from esm.sh.

ije avatar ije commented on May 14, 2024

@FallingSnow can you please try ./node_modules/.bin/esbuild app.ts --bundle --platform=web --outfile=out.js

from esm.sh.

FallingSnow avatar FallingSnow commented on May 14, 2024

Screenshot from 2021-01-12 21-36-07
Export is good still. Btw --platform=browser is the correct flag. Are we using the same esbuild version?

$ ./node_modules/.bin/esbuild --version
0.8.31

from esm.sh.

ije avatar ije commented on May 14, 2024

Screenshot 2021-03-30 at 03 02 58

from esm.sh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.