-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
TypeScript import '@types/handlebars';
leads to "Cannot resolve dependency '@types/handlebars'"
#615
Comments
It may be related to microsoft/TypeScript#9725 but
does not complain about anything. |
It's due to the fact that Parcel doesn't use the TypeScript compiler but the the transpiler, it doesn't do Solution:
|
Thank you. This helped a lot. I have a different (but related to handlebars) issue.
AFAIK, the issue is that handlebars module contains node fs call which is not available in the browser target. Any suggestion for Parcel? My import code
Thanks. |
I created #587 to warn instead of throwing when a fs call cannot be statically evaluated, you can try it while it's being reviewed. If it does not work I'm not aware of a resolve alias feature in Parcel, the TypeScript plugin supports TypeScript path rewriting using the {
"compilerOptions": {
// ...
"baseUrl": ".",
"paths": {
"handlebars": ["handlebars/dist/handlebars.min.js"]
}
}
} |
I got a similar error when I use custom tsconfig "baseUrl": "./",
"paths": {
"@src/*": [
"src/*"
]
}, output
But in development mode curiously works. |
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. |
Choose one: 🐛 bug report
X Cannot resolve dependency '@types/handlebars'
🎛 Configuration (.babelrc, package.json, cli command)
Babel: no
🤔 Expected Behavior
The import command tells TypeScript to include a declaration file. Without this line any reference to Handlebars module are highlighted as invalid (PhpStorm). Even if the JS file for handlebars is imported with
😯 Current Behavior
💁 Possible Solution
No idea.
🔦 Context
It's hard/impossible to continue working with parcel-bundler and Handlebars library with TypeScript which requires the declaration file to be imported.
💻 Code Sample
See above.
🌍 Your Environment
Thanks.
The text was updated successfully, but these errors were encountered: