-
Notifications
You must be signed in to change notification settings - Fork 21
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
Can't use with isolated modules #38
Comments
Yes, we decided to export const enums because it has a very large impact on the code size for DIM. You'll need to use https://www.npmjs.com/package/babel-plugin-const-enum - try looking at DIM's config to see how we're consuming this. |
Hi everyone, I created my project from scratch using I'm checking the I'm still searching a workaround. 👀 FYI: I have this property activated and I still have the issue |
This is a pretty hard blocker when working with this library in Next.js :( |
You do not need to set isolatedModules: false but you do need to enable the const enum optimization for babel-typescript. See the DIM source for examples on usage. |
Closing since the library is usable from Babel-only transpilation. See https://github.com/DestinyItemManager/DIM/blob/master/babel.config.js |
Ok. I assume this is the relevant part of the babel config for DIM? plugins.push(['@babel/plugin-transform-typescript', { isTSX: true, optimizeConstEnums: true }]); I tried following the nextjs instructions on how to customize the babel config. Here's the {
"presets": ["next/babel"],
"plugins": [
[
"@babel/plugin-transform-typescript",
{ "optimizeConstEnums": true }
]
]
} But I still get the same error about isolated modules. Any thoughts on why that might be the case? |
Ok for now I've "solved" this for me at least. I ended up just forking the repo and replacing the usage of For posterity: If anyone has this issue in the future you can try to use my fork bungie-api-ts-no-const-enum |
I built up a test next.js project, and I see the problem you're talking about. I got confused - you're right that enabling I'll think through a workflow for publishing a no-const-enum version of this library, though it's very sad that you won't be able to use the more optimized version because of something that's not preventing any functional issue. BTW, I think this is how you configure the TypeScript babel config in next.js:
|
You're the best! |
Any updates on this one? |
No, still thinking through how best to retain the massive code size optimization of inlining the numeric values without publishing a whole different version of the library. I'll be sure to update this when I have a solution. |
Having the same problem. Any solutions found? |
|
I'm new to typescript, so I don't fully understand this compilation error:
but it led me here:
https://ncjamieson.com/dont-export-const-enums/
The text was updated successfully, but these errors were encountered: