Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

Problem importing React component (Cannot find module...) #64

@rhyek

Description

@rhyek

I'm working on an existing project that uses Blaze and I'm trying to create a couple of React Components. I have something like this:

packages/
  implementation/
    ui/
      components/
        ComponentA.tsx
        ComponentB.tsx
      some-blaze-component/
        some-blaze-component.js

some-blaze-component imports ComponentA via a relative import (import ComponentA from '../components/ComponentA') which works fine.

The issue is when trying to import ComponentB from ComponentA using import ComponentB from './ComponentB'. I get an error in the browser stating Cannot find module '/ndm_implementation/ui/components/ComponentB'.

Inside project_path\.meteor\local\build\programs\web.browser\packages\ndm_implementation.js if I change that reference from '/ndm_implementation/ui/components/ComponentB' to ./ComponentB' and do a hard reaload it works.

My .tsconfig:

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "lib": [
      "dom",
      "es2017"
    ],
    "jsx": "react",
    "strict": true,
    "allowJs": true
    }
  },
  "include": [
    "packages/implementation/**/*"
  ],
  "exclude": [
    "node_modules",
    ".meteor"
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions