Code Monkey home page Code Monkey logo

Comments (8)

FallingSnow avatar FallingSnow commented on May 13, 2024 4

I've worked out that the input going into esbuild is incorrect. Here is effectively the cause of the compiler fail:

export const { version,versionInfo,graphql, ....... } = graphql;

Note this is passed in at https://github.com/postui/esm.sh/blob/c61d1a05462a1d413f2b69797093e3ae54de7912/server/build.go#L465

An example of what the compiler is trying to compile:

const graphql = {
	graphql: "test"
};
export const { graphql } = graphql;
export default graphql;

Which results in

$ node script.js
file:///tmp/script.js:4
export const { graphql } = graphql;
               ^

SyntaxError: Identifier 'graphql' has already been declared
    at Loader.moduleStrategy (node:internal/modules/esm/translators:145:18)
    at async link (node:internal/modules/esm/module_job:47:21)

Now to find out why esbuild is being passed this.

from esm.sh.

FallingSnow avatar FallingSnow commented on May 13, 2024 1

Esbuild seems to have no problem bundling it locally.

app.tsx:

import * as Graphql from "graphql";
console.log(Graphql)
$ yarn add esbuild graphql
$ node_modules/.bin/esbuild app.tsx --bundle --outfile=out.js

from esm.sh.

shadowtime2000 avatar shadowtime2000 commented on May 13, 2024

Looks like it is partially a problem with the graphql package and how they wrote it

from esm.sh.

shadowtime2000 avatar shadowtime2000 commented on May 13, 2024

Strange...

from esm.sh.

shadowtime2000 avatar shadowtime2000 commented on May 13, 2024

Maybe ESM is using an older version of esbuild?

from esm.sh.

ije avatar ije commented on May 13, 2024

@FallingSnow thanks, i will figure it out what happened.

from esm.sh.

ije avatar ije commented on May 13, 2024

@FallingSnow thanks for the details, it is vary useful for me, and i just fixed it! please try it agian: https://esm.sh/graphql.

from esm.sh.

FallingSnow avatar FallingSnow commented on May 13, 2024

Great, it's working great! I'm finally only using esm.sh and denoland.

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.