Giter Club home page Giter Club logo

Comments (5)

RyanCavanaugh avatar RyanCavanaugh commented on April 27, 2024

It looks like you're using a package manager that doesn't set up symlinks, so TS has no way to know that you have the outer monorepo setup, thus doesn't have any way to know that packages/ is where you can find a. The easiest way is to address that is to just add a baseUrl:

    "baseUrl": "../"

from typescript.

remcohaszing avatar remcohaszing commented on April 27, 2024

I see I forgot to specify you have to run npm install, but I did do this in my testing. This creates symlinks.

I forgot that TypeScript doesn’t validate bare import specifiers, but it does check dynamic imports. Apart from that the difference between an import statement or an import declaration doesn’t matter. I updated the example repo to make b export something from a. This also makes the error appear.

This made me suspicious, because in my real world code one workspace does have this problem, but another doesn’t. It turns out enabling resolveJsonModule in the dependant module (b) makes the error go away, even though there are no JSON imports anywhere. I added a this option, commented, so it can be toggled easily.

baseUrl doesn’t solve the problem, because the real world example uses scoped packages. This can be solved using paths, but I don’t think that should be necessary.

from typescript.

RyanCavanaugh avatar RyanCavanaugh commented on April 27, 2024

Something's gone wrong here; tsc -b -f b fails but tsc -p b does not

from typescript.

remcohaszing avatar remcohaszing commented on April 27, 2024

Apparently the workaround of enabling resolveJsonModule only works if this is enabled in the configuration file of b directly, not if it’s enabled in a configuration it extends from.

from typescript.

fatcerberus avatar fatcerberus commented on April 27, 2024

Apparently the workaround of enabling resolveJsonModule only works if this is enabled in the configuration file of b directly, not if it’s enabled in a configuration it extends from.

That sounds like a bug - if you can repro it, you should report that in a separate issue.

from typescript.

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.