GithubHelp home page GithubHelp logo

Comments (8)

sam-goodwin avatar sam-goodwin commented on May 30, 2024

Perhaps functionless/register instead of the lib

from functionless.

tvanhens avatar tvanhens commented on May 30, 2024

Perhaps functionless/register instead of the lib

This is what I originally wanted but I'm not sure how to reconcile this with how the project is currently packaged in the lib director.

from functionless.

sam-goodwin avatar sam-goodwin commented on May 30, 2024

Perhaps functionless/register instead of the lib

This is what I originally wanted but I'm not sure how to reconcile this with how the project is currently packaged in the lib director.

I'm pretty sure that is only true when importing the "functionless" - which refers to the package.json/main property. If you import a file directly, you have access to the root folder of the package.

We should verify, but i think this is how it works.

// "node_modules/functionless/lib/index.ts" because of package.json/main
import "functionless";

// "node_modules/functionless/register.js"
import "functionless/register" 

from functionless.

tvanhens avatar tvanhens commented on May 30, 2024

Just tried this and it fails due to being unable to find the module. There has to be a way to make it work though. Probably some other config in the package.json. I'll keep digging since I think it looks much cleaner without the lib.

from functionless.

sam-goodwin avatar sam-goodwin commented on May 30, 2024

Is it included in the tgz?

from functionless.

tvanhens avatar tvanhens commented on May 30, 2024

Yeah it is but its in the lib directory. For some reason node doesn't seem to treat the main entrypoint as the root when resolving nested files, it treats the package.json location as the root.

from functionless.

sam-goodwin avatar sam-goodwin commented on May 30, 2024

Yeah it is but its in the lib directory. For some reason node doesn't seem to treat the main entrypoint as the root when resolving nested files, it treats the package.json location as the root.

Move it to the root and it'll work.

functionless/register.js

from functionless.

sam-goodwin avatar sam-goodwin commented on May 30, 2024

The only special case is when importing the module by name. All other file references start from the root. main only affects the default import.

from functionless.

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.