GithubHelp home page GithubHelp logo

Issues with pnpm about esmock HOT 8 CLOSED

PatrickHeneise avatar PatrickHeneise commented on June 5, 2024
Issues with pnpm

from esmock.

Comments (8)

PatrickHeneise avatar PatrickHeneise commented on June 5, 2024 1

Thanks for the support! I'll try to run it later or tomorrow again with experimental mode and the full path, see what works.

from esmock.

iambumblehead avatar iambumblehead commented on June 5, 2024 1

@PatrickHeneise thanks and regards hoping everything is good for you this holiday season. Feel free to re-open or message any time

from esmock.

iambumblehead avatar iambumblehead commented on June 5, 2024

Related PnP-compatibility changes were made for this issue #176

@koshic do you know of a solution for using esmock with PnP? It seems to still not be working. @koshic @PatrickHeneise esmock could be updated with changes you might recommend for resolving this issue

from esmock.

koshic avatar koshic commented on June 5, 2024

@iambumblehead pnpm and yarn PnP are very different things )

I can answer about PnP only:

  1. yarn unplug esmock to place it somewhere inside .yarn/unplugged dir
  2. yarn node --loader $(yarn node --input-type=module -e 'console.log((await import("module")).default.findPnpApi(".").resolveRequest("esmock", ${process.cwd()}/dummy.js, { conditions: new Set(["import"]) }))')

Sure, we can create simple wrapper for second step - do the same to get esmock path, dynamically import esmock and export load + resolve hooks (my reason why I requested changes in 'is esmock loaded?' fn).

from esmock.

iambumblehead avatar iambumblehead commented on June 5, 2024

@koshic ah I see pnpm is a different thing!

@PatrickHeneise which moduleId is not found? Would you share the full message? If you use esmock with --experimental-import-meta-resolve do your tests run correctly?

from esmock.

iambumblehead avatar iambumblehead commented on June 5, 2024

@PatrickHeneise would you try esmock using the full path to the module for which moduleId is not found? For example, if the '@google-cloud/secret-manager' moduleId is not found, try something like,

  const { fetchVariable } = await esmock('../lib/fetchVariable.js', {
-    '@google-cloud/secret-manager': {
+    '/full/path/to/node_modules/@google-cloud/secret-manager': {
       // ...
    }
  })

another way...

  const { fetchVariable } = await esmock('../lib/fetchVariable.js', {
-    '@google-cloud/secret-manager': {
+    [new URL('@google-cloud/secret-manager', import.meta.url)]: {
       // ...
    }
  })

from esmock.

iambumblehead avatar iambumblehead commented on June 5, 2024

@PatrickHeneise also feel free to submit a failing test and I will merge and try to resolve per https://github.com/iambumblehead/esmock/blob/master/CONTRIBUTING.md

from esmock.

PatrickHeneise avatar PatrickHeneise commented on June 5, 2024

tomorrow ... closing this as I don't have capacity at the moment. Will run the test when I get back to this project. Thanks though!

from esmock.

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.