GithubHelp home page GithubHelp logo

Comments (4)

itaymendel avatar itaymendel commented on September 26, 2024 1

it is really not recommended for components to import internal files or self-refer to the package name. this may cause compilation issues down the line.

if you want Bit to stop complaining on some issues, you can add a similar config to your worksapce.jsonc

"teambit.component/issues": {
    "ignoreIssues": [
      "CircularDependencies",
      "DuplicateComponentAndPackage"
    ]
  },

all possible issues are here - https://github.com/teambit/bit/tree/master/components/component-issues

from bit.

GiladShoham avatar GiladShoham commented on September 26, 2024 1

In addition to what @itaymendel wrote.
It's not recommended to use aliases, as these imports are context aware. Aka needs a tsconfig to set these aliases which make the components not portable.
Any component is available to be consumed via its package name (even before export/publishing).
This is also more standard way for import as it's not tool specific.
So please use package names.

from bit.

MatthD avatar MatthD commented on September 26, 2024

Hello ! Sorry and thanks for the informations but in fact we were looking for a backend solution of monorepo workspace management, and found BIT on the pnpm docs

It's not very clear for us what our apps and packages can be related to BIT, but if we understood correctly anything can be a component.
A good way in dev to avoid relative import and help moving/maintain is to use TS path aliases.

So does that means Bit is not for backend typescript project ?

In fact we are using packages name. but it's not very suitable when we are dealing in terme of dev-experience, we need to re-run bit link/bit compile on every new file, and removed/renamed files are still visible, so TS alias in dev are more suitable, we just have TS path alias overriding the scope/name.

In fact to resume we just need Bit as a workspace dependencies management (and it shine wth bit status, bit show ...), not really for component compile .. (we will continue to compile our backend app via TSC etc ..)

from bit.

itaymendel avatar itaymendel commented on September 26, 2024

Bit doesn't support ts paths between components, as they are related to the specific file system structure of the workspace, and locks you to a specific FS structure.

In bit, each component is automatically linked via node-modules, and you are expected to use these module links.
the question is on your backend developer is mostly "what is a component", as in bit, if you need to share code between your backends the goal is to move it to it's own component/library, and not import from internal files.

from bit.

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.