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

Can't import module types locally #9911

Open
StandingPadAnimations opened this issue Aug 13, 2024 · 0 comments
Open

Can't import module types locally #9911

StandingPadAnimations opened this issue Aug 13, 2024 · 0 comments

Comments

@StandingPadAnimations
Copy link

🐛 bug report

When importing Chart.JS types locally, ParcelJS always throws an error stating it can't find the module with types. Doing the following in a TypeScript file:

import { Chart } from "./chartjs/dist/types";

results in the following error

🚨 Build failed.

@parcel/core: Failed to resolve './chartjs/dist/types' from './src/gpachart/gpachart.ts'

  /home/mahid/Documents/Skyward-GPA-calculator/src/gpachart/gpachart.ts:3:23
    2 | import { Settings } from "../settings";
  > 3 | import { Chart } from "./chartjs/dist/types";
  >   |                       ^^^^^^^^^^^^^^^^^^^^^^
    4 | 
    5 | let GPAGraphArray: GraphValueType[];

@parcel/resolver-default: Cannot load file './chartjs/dist/types' in './src/gpachart'.
💡 Did you mean './chartjs/dist/types'?
💡 Did you mean './chartjs/dist/types.d'?

However, the module is indeed located at that path. It seems ParcelJS doesn't want to load the .d.ts files.

🎛 Configuration (.babelrc, package.json, cli command)

{
  "scripts": {
    "dev": "rm -rf .parcel-cache  && parcel watch src/manifest.json --host localhost",
    "build": "rm -rf .parcel-cache && parcel build src/manifest.json"
  },
  "devDependencies": {
    "@eslint/js": "^9.8.0",
    "@parcel/config-webextension": "^2.12.0",
    "@parcel/transformer-typescript-tsc": "^2.12.0",
    "@parcel/validator-typescript": "^2.12.0",
    "@types/chrome": "^0.0.269",
    "@types/eslint__js": "^8.42.3",
    "eslint": "^9.8.0",
    "parcel": "^2.12.0",
    "prettier": "3.3.3",
    "typescript": "^5.5.4",
    "typescript-eslint": "^8.0.0"
  }
}

🤔 Expected Behavior

This building perfectly fine

😯 Current Behavior

Getting an error where I can't import the module types

💁 Possible Solution

🔦 Context

💻 Code Sample

https://github.com/watchbutdonotlearn/Skyward-GPA-calculator/ (rewrite branch)

🌍 Your Environment

Software Version(s)
Parcel 2.12.0
Node v18.20.4
npm/Yarn Yarn 1.22.22
Operating System Arch Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant