Don't like the new CDK v2 way of importing. IDE ca...
# random
a
Don't like the new CDK v2 way of importing. IDE can't resolve for me. Everything is longer. 😞
Copy code
import { cloudformation_include as cloudformation, aws_iam as iam, aws_s3 as s3, RemovalPolicy } from "aws-cdk-lib";
m
You can do
import * as iam from 'aws-cdk-lib/aws-iam';
or
import { PolicyStatement } from 'aws-cdk-lib/aws-iam';
I'm not a fan of the style you quoted. Looks ugly to me.
a
Ah, didn't see that the folder approach is available. That's an improvement.
m
It means you have more distinct imports, but it also means that refactoring from v1 is even easier. You are just replacing
@aws-cdk
with
aws-cdk-lib
in many cases.
a
Old code was
import * as cdk
Have to find where all the types are hiding in the new library.
m
That's where it doesn't work. Still as upgrade paths go and somebody who used to work with spring, this is easy 😉
a
Oh, now I found the working pattern. 👍
Gotta go back and revert all the hard stuff I just did. 😄
m
glhf 😉
t
I think future js is gonna be all about importing from nested folders
Based on my esm research
m
A grim future
a
If the IntelliJ would be smart enough to do it, I'd be fine with it.