-
Notifications
You must be signed in to change notification settings - Fork 171
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
Webpack & TypeScript support #52
Comments
Hi @Nightbr, as you mentioned, DefinitelyTyped/DefinitelyTyped#38318 has been opened over on DefinitelyTyped for this. However, I don't think it'll be worked unless someone submits a PR. I'm not really familar with TypeScript, but this is what I think the new file should look like: https://github.com/patorjk/DefinitelyTyped/blob/figlet_fix/types/figlet/index.d.ts However, I'm not on a computer where I can run the DefinitelyTyped code. If you want to put in PR for this fix definitely do so. Otherwise if I get some time tonight I'll try and put in a PR with the above branch (all I did for that was put in the line I think is missing). |
Hi @patorjk , How about adding an index.d.ts in the package, would you like a PR? |
Hi there. I got a similar error. I'm building a npm package, which should contain figlet. If I test it I get following error: index.js file
Does someone has an idea what I'm doing wrong? Edit: If I import both
|
I would accept a PR. |
Hello, Until the TypeScript definition on DefinitelyTyped is updated, you can use something like that in your project (inspired from DefinitelyTyped/DefinitelyTyped#38318 and https://github.com/aplr/DefinitelyTyped/commit/099f9bea0641922116078c2421e234e72e3a2cb6):
Of course, you'll need to update your TypeScript project configuration to load custom types. For example:
|
It's 2021, why do we still want to support webpack. Why not just support native ES code and everybody can use it without webpack? |
@elgs sure thing, make a PR to refactor this lib into a native ES module and it could be bundle with any ES bundler 👌 |
resolve the problem , thanks |
Does this have es support now then? |
Hello there, first of all, thanks for this awesome package which enhances all our CLI tool 👍
Problem Statement
We would like to develop a more robust CLI tool using Webpack & TypeScript. Everything is setup and works properly but I'm running into some errors with figlet integration.
Context
Here is my setup for the project, I will create a boilerplate if needed on Github.
But right now, I can share the webpack.config.js:
and the tsconfig.json
But when I want to use figlet there is some errors.
First, with a simple implementation:
This will throw an error because webpack doesn't achieve to resolve the fonts folder.
I saw issues about this: #46 & #50 but the
node: { __dirname: false }
just don't work (or you have to copy the fonts folder at root of your project) &figlet.parseFont
has no typing - see DefinitelyTyped/DefinitelyTyped#38318Add to this, the solution with parseFont is the best I think but you have to declare all importable-fonts in the typing too or you will get this error:
If the 'figlet' package actually exposes this module, consider sending a pull request to amend 'https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/figlet.ts(7016)
Possible Solution
I think we just need to update the typing of figlet on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/figlet/index.d.ts
I'm not an expert on module typing with TypeScript that's why I create an issue & not a pull request in order to discuss the best way to create the typing.
Thanks for help 👍
The text was updated successfully, but these errors were encountered: