Giter Site home page Giter Site logo

process is not defined about import-sync HOT 5 CLOSED

nktnet1 avatar nktnet1 commented on June 18, 2024
process is not defined

from import-sync.

Comments (5)

fonziemedia avatar fonziemedia commented on June 18, 2024 1

Hey thanks for the quick response.

I'm indeed trying to run it for a frontend application running node 20.8.0 with vite

I guess I'll have to look for for another way to go around the issues I'm experiencing but thanks anyway :)

from import-sync.

fonziemedia avatar fonziemedia commented on June 18, 2024 1

Hey @nktnet1

Thanks for the suggestion but it seems require-esm-in-cjs is also server-side only..

By the way, the error I was getting was actually related to vite:
vitejs/vite#1973

I've managed to fix it but then I started getting other errors related to node.. 🤷 I guess I'll just have to do some refactoring of the project..

Thanks again for your help!

from import-sync.

nktnet1 avatar nktnet1 commented on June 18, 2024

Hi @fonziemedia,

Thank you for reaching out.

Could you provide a minimal reproducible example for this issue? Other information such as your node version and the content of your package.json would help.

Note that unfortunately, import-sync only works with NodeJS (server-side), not client-side (e.g. frontend development and the like) see below. If your project is indeed NodeJS, please first confirm that you are able to access NodeJS process - e.g. as simple as

console.log(process);

Finally, the error suggests that the issue may lie with the esm module, a dependency of import-sync. It may be worth it to look through the issues in that project too to see if there are any workarounds :).

from import-sync.

nktnet1 avatar nktnet1 commented on June 18, 2024

@fonziemedia you can maybe try your luck with this module

although there are some performance implications to consider, for example as a result of using deasync. Hope this points you in the right direction though :).

from import-sync.

nktnet1 avatar nktnet1 commented on June 18, 2024

Found this fork of fractal that uses Vite and import-sync together:

so I'm not so sure about my comment regarding only server-side NodeJS anymore 🤷

e.g. it's being used here in ./packages/react/src/adapter.js#L13:

Maybe there is a configuration somewhere that allows the esm module to work.

Also found some workarounds:

from import-sync.

Related Issues (4)

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.