This message was deleted.
# general
s
This message was deleted.
c
@dry-football-2639 I had a similar issue the other day - are you creating resources in a non-index file, and then re-exporting them from the index file? e.g. your above code snippet in
buckets.ts
and then
Copy code
export * from './buckets';
in
index.ts
?
b
@cuddly-father-4905 Yes, that is exactly what I am doing.
c
@dry-football-2639 in that case, I found that manually importing and exporting modules works far better than just re-exporting them, e.g.
Copy code
import * as buckets from './buckets';

export {
  buckets
};
It's not as clean as just re-exporting, but it seems to have resolved this issue for me so far
b
@cuddly-father-4905 Do you have any background information on this (any pointer to a GitHub ticket/discussion, documentation, …)?
c
@dry-football-2639 unfortunately not; I couldn't find anything about it myself, and arrived at this solution just via trial and error
I meant to file a GitHub issue about it but haven't gotten around to it yet
d
@cuddly-father-4905 I believe you're tagging the wrong Alex 🙂
🤦‍♂️ 1
c
Woops, sorry haha CC @busy-honey-73811 ^
b
@cuddly-father-4905 OK, thanks for the hint, I will check whether this might help in my case.
👍 1
w
This is for better or worse part of how TypeScript works by default. `import`s which don't use any values from the import get elided and are not emitted as `require`s in the JavaScript code, and therefore don't cause any side effects that loading the module might ensure happen. See for example https://github.com/microsoft/TypeScript/issues/2812. That said - it looks like TypeScript 3.8 added a flag to control this behaviour: https://www.typescriptlang.org/tsconfig/#importsNotUsedAsValues. We should almost certainly set that to
preserve
by default for Pulumi projects since these style of side effects are very common in Pulumi programs.
👍 1
We should almost certainly set that to 
preserve
 by default for Pulumi projects since these style of side effects are very common in Pulumi programs.
Opened https://github.com/pulumi/pulumi/issues/7017 to track this.
b
@white-balloon-205 Thanks for those insights and creating the ticket. I will set
importsNotUsedAsValues
to
preserve
for my TypeScript stacks.