-
Notifications
You must be signed in to change notification settings - Fork 369
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
Improve support for various TypeScript setups, including "nodenext" #405
Conversation
Thats strange. I get uzlopak@Battlestation:~/workspace/nodenext-mvce$ npm run build
> [email protected] build
> tsc -p .
node_modules/@fastify/helmet/types/index.d.ts:2:18 - error TS2614: Module '"helmet"' has no exported member 'contentSecurityPolicy'. Did you mean to use 'import contentSecurityPolicy from "helmet"' instead?
2 import helmet, { contentSecurityPolicy, HelmetOptions } from 'helmet';
~~~~~~~~~~~~~~~~~~~~~
|
@Uzlopak Could you show me a sample project that reproduces your issue? It looks like you're trying to import |
i use https://github.com/Uzlopak/nodenext-mvce with the branch helmet-issue |
How is this pulling in the updated Helmet? Are you doing it manually?
|
Yes. I ran the npm i command you posted above.
Evan Hahn ***@***.***> schrieb am Mi., 15. März 2023, 15:24:
… How is this pulling in the updated Helmet? Are you doing it manually?
—
Reply to this email directly, view it on GitHub
<#405 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABGTEHB57UEERKA4GIZB6F3W4HGLXANCNFSM6AAAAAAV3C6I2U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've got a question for this, can we remove the It makes typescript think this package is ES module only, and refuses to resolve the cjs types even when I compile with target commonjs. That only happens when using |
@Uzlopak Look for @yi-fan-song Are you suggesting we remove |
from helmet
…On Wed, Mar 15, 2023, 4:39 p.m. Evan Hahn ***@***.***> wrote:
@Uzlopak <https://github.com/Uzlopak> Look for helmet in your node_modules
directory. Is there a dist/types/ folder there?
@yi-fan-song <https://github.com/yi-fan-song> Are you suggesting we
remove "type": "module" from Helmet? Or from your own code?
—
Reply to this email directly, view it on GitHub
<#405 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKVC75DYUMWXXDPKC6KE3HTW4ISJVANCNFSM6AAAAAAV3C6I2U>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I dont think that removing the type: module from helmet is useful, as we are moving to esm. But we should be enable cjs for cjs modules. And this is the reason why we have this PR. That is actually also the reason why it fails in @fastify/helmet, as @fastify/helmet is cjs and not esm. I will have a look at your changes @EvanHahn and will come back to you asap |
@EvanHahn |
66f954a
to
dfb2ee7
Compare
I just made a few changes. Please try it out with |
I'm going to merge this soon. Please let me know if this fails to work for you. |
I intend to make some more updates here but they're not quite ready. |
This has been published in |
Please try this out by running
npm install 'https://evanhahn.com/tape/helmet-6.0.1.tgz'
.Closes #389 and #391.
When I merge this, I'll make @Uzlopak the author.