Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module './...' #1480

Closed
inad9300 opened this issue Jun 2, 2018 · 5 comments
Closed

Cannot find module './...' #1480

inad9300 opened this issue Jun 2, 2018 · 5 comments
Labels
🐛 Bug Stale Inactive issues

Comments

@inad9300
Copy link

inad9300 commented Jun 2, 2018

🐛 bug report

I seem to be experiencing a problem similar to #668. I am not using Vue though, but simply the library @soil/dom.

When having an index.ts as slim as:

import {h} from '@soil/dom'

console.log('h', h)

I get Error: Cannot find module './html/h'.

💻 Code Sample

The whole code base can be found at https://github.com/inad9300/Soil/tree/7aebb9e8361e515f4661aecda025172e74c8db9c/examples/notes. This might be useful in terms of configuration files, etc. In terms of the actual code, the snippet shown above is enough to reproduce the problem.

@inad9300
Copy link
Author

inad9300 commented Jun 9, 2018

Did you have any time to look into this?

I would like to understand where is Parcel trying to find './html/h' and why. Related to this, I have a couple of questions:

  • Where can I read about Parcel's module resolution algorithm?
  • Is there any hidden --debug or --verbose flag to get more (some) information about the error?
  • Why isn't the error shown when building the project, but only later in the browser?

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Jun 9, 2018

There is currently no verbose logging, there are a couple of open PR's related to it though, for example #1385 and #1472

I haven't looked into the issue, pretty busy atm

@inad9300
Copy link
Author

inad9300 commented Jun 9, 2018

One other clarification that might help: the directory structure of @soil/dom in npm is as follows:

@soil/
└── dom
    ├── build
    │   ├── html
    │   │   ├── h.js
    │   │   └── ...
    │   ├── index.js
    │   └── ...
    ├── package.json
    └── ...

Where the package.json looks like this:

{
    "main": "build/index.js",
    ...
}

And the index.js file at some point does:

// ...
var h_1 = require("./html/h");
exports.h = h_1.h;
// ...

So it seems that Parcel could figure out the complicated part (looking into the package.json for the "main" field and so on), but then it cannot resolve the relative path. (Just guessing, really, as I understand very little about how it works.)

@inad9300
Copy link
Author

inad9300 commented Jun 9, 2018

I have started a project of a similar nature using webpack this time, and it raises the same errors (although much better described). In consequence, I have open this question in StackOverflow: https://stackoverflow.com/questions/50773966/webpack-typescript-module-not-found.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Jan 17, 2020
@github-actions github-actions bot closed this as completed Feb 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Stale Inactive issues
Projects
None yet
Development

No branches or pull requests

2 participants