-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Ignoring declares #50
Comments
Hi,
glad to hear that, thanks! Do you have a little repro without your code? What is your |
I'll create a repo demonstrating the problem. |
Hey, Simpler way this see the issue is just to run $ node run-dts-bundle-generator-on-server.js
packages/server/src/schema/index.ts(7,15): error TS2304: Cannot find name '__DEV__'.
packages/server/src/schema/query/index.ts(5,27): error TS2307: Cannot find module 'src/pem/dev-private-key.pem'.
C:\Users\uv\dev\mono-js-boilerplate\node_modules\dts-bundle-generator\check-diagnostics-errors.js:20
throw new Error(failMessage);
^
Error: Compiled with errors
at checkDiagnosticsErrors (C:\Users\uv\dev\mono-js-boilerplate\node_modules\dts-bundle-generator\check-diagnostics-errors.js:20:11)
at Object.checkProgramDiagnosticsErrors (C:\Users\uv\dev\mono-js-boilerplate\node_modules\dts-bundle-generator\check-diagnostics-errors.js:11:5)
at getDeclarationFiles (C:\Users\uv\dev\mono-js-boilerplate\node_modules\dts-bundle-generator\compile-dts.js:67:32)
at Object.compileDts (C:\Users\uv\dev\mono-js-boilerplate\node_modules\dts-bundle-generator\compile-dts.js:15:20)
at generateDtsBundle (C:\Users\uv\dev\mono-js-boilerplate\node_modules\dts-bundle-generator\bundle-generator.js:33:33)
at Object.<anonymous> (C:\Users\uv\dev\mono-js-boilerplate\run-dts-bundle-generator-on-server.js:4:13)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12) There is also a problem on the client ( |
Ok, thank you! I will take a look to your repro at Monday. For now, I can suggest you a workaround (I believe it should help to fix it) - you need to include your |
Hi @unimonkiez, the reason of this error is that In your case it is similar to run the following: To fix this, as I said in #50 (comment), you need to reference to your Also I do not think that we need to build the whole project before start generating dts bundle or even to have CLI/API's option for that. |
If you have further questions/suggestions/thoughts - please tell me. |
I have the same problem with a code that imports .scss files. Initially I had multiple errors like:
Now it compiles, but the result check fails with:
Can I workaround it somehow? |
Hey @drudv,
Yeah, you need to add your declaration of |
Hey @timocov Thanks for the help. I tried to add the directory containing scss type definitions to Could you please suggest anything more? ;) |
@drudv Sorry for long delay.
I'm not sure that it's a reason of this error. I've used this approach in product I'm working on and it works fine for us. Is it your project private/not open-sourced? It looks like @foxable already created an issue to fix it without applying |
Still trying to figure this out. I have
I import it in
I have added I still do not see Could anyone provide a working example please? |
@timocov I have looked through issues including closed ones for a possible solution as well as examples and tests. Unfortunately, none have worked for the issue above. Do you have a working example with |
@igorpupkinable can you create a repro please? |
@timocov could you give any hints for the above please? Unfortunately, this is blocking our team to publish a core package. |
Hi @igorpupkinable, sorry for late reply. First of all, please read #66 (comment) and #102 (comment) to see difference between how The other thing I don't really get from your messages is what do you expect to see in the bundle result. If you add the line above you'll get the following output: import { FC } from 'react';
export declare type CheckboxProps = {
label: string;
onChange: (value: boolean) => void;
value?: boolean;
};
export declare const Input: {
Checkbox: FC<CheckboxProps>;
};
export {}; There is still no module declaration for |
You are right. |
How can i work with images with this bundle? |
@Rgnwld please read this comment #50 (comment) |
Bug report
I'm bundling my code with webpack, and I have some
declares
in my files:Input code -
src/globals.d.ts
Webpack bundles fine, and also my editor (vscode) recognizes everything, but when using you library (which is great btw!) it doesn't consider the
d.ts
files which are placed insrc
folder.Code -
src/store/router/index.ts
Actual output
The text was updated successfully, but these errors were encountered: