Giter VIP home page Giter VIP logo

Comments (8)

 avatar commented on May 23, 2024 1

I started the program also with node --experimental-modules ./server.mjs and @std/esm, but no success. The same without @std/esm. Only the error message is more informative. I found no solution other than import by default and destructuring the imported default object. Thank you for your help.

from graphql-upload.

 avatar commented on May 23, 2024 1

Ok, maybe you can use a temporary solution with a mix of default and variable import like this one:
import myDefault, * as myModule from "my-module";
Not sure if it works for both, vanilla Node and Babel.

And then you can add a conditional assignment like that:
const graphql = myDefault || myModule

from graphql-upload.

 avatar commented on May 23, 2024 1

Now, it works - thanks 👍

from graphql-upload.

jaydenseric avatar jaydenseric commented on May 23, 2024

I was using vanilla --experimental-modules, but have recently been using @std/esm in cjs mode so it's possible this slipped under the radar. The intent is to be 100% vanilla .mjs compatible. Looking into it now…

from graphql-upload.

jaydenseric avatar jaydenseric commented on May 23, 2024

Hang on, the fix is not working 😱

from graphql-upload.

jaydenseric avatar jaydenseric commented on May 23, 2024

The issue is that this in the source works correctly for .mjs, but breaks in the .js:

import graphql from 'graphql'
export const GraphQLUpload = new graphql.GraphQLScalarType({})

While this breaks the .mjs but works for the .js:

import * as graphql from 'graphql'
export const GraphQLUpload = new graphql.GraphQLScalarType({})

Not sure if it is a Babel bug or what.

from graphql-upload.

jaydenseric avatar jaydenseric commented on May 23, 2024

Related? babel/babel#6983

from graphql-upload.

jaydenseric avatar jaydenseric commented on May 23, 2024

This should be fixed in v4.0.2. I'll continue to investigate a better solution.

I've updated the example API to use native modules instead of @std/esm.

from graphql-upload.

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.