Skip to content

bug: logLevel enum is not exported #30255

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

Closed
3 tasks done
5im0n opened this issue Mar 14, 2025 · 4 comments · Fixed by #30335
Closed
3 tasks done

bug: logLevel enum is not exported #30255

5im0n opened this issue Mar 14, 2025 · 4 comments · Fixed by #30335
Labels
type: bug a confirmed bug report

Comments

@5im0n
Copy link
Contributor

5im0n commented Mar 14, 2025

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

The release of Ionic 8.5.0 introduced the logLevel option in IonicConfig.

However, the LogLevel enum is not exported by the @ionic/core module.
As a result, we are unable to use LogLevel.OFF (or any other value from LogLevel) when defining the logLevel property in IonicConfig.

We can't configure it

import { IonicConfig, LogLevel } from '@ionic/core'; // Error LogLevel  is not exported

export const ionicConfig: IonicConfig = {
  logLevel: LogLevel.OFF,
  mode: 'md',
  spinner: 'lines',
  swipeBackEnabled: false,
};

Expected Behavior

The LogLevel enum should be properly exported by @ionic/core, allowing developers to set the logLevel in IonicConfig without any import issues.

import { IonicConfig, LogLevel } from '@ionic/core';

const config: IonicConfig = {
  logLevel: LogLevel.OFF, // ✅ This should work without any import issues
  mode: 'md',
  spinner: 'lines',
  swipeBackEnabled: false,
};

Steps to Reproduce

  1. Install or upgrade to @ionic/core version 8.5.0.
  2. Import LogLevel from @ionic/core in a TypeScript file.
  3. Define logLevel: LogLevel.OFF inside IonicConfig.
  4. Observe that TypeScript raises an error due to LogLevel not being exported.

Code Reproduction URL

https://stackblitz.com/edit/ykhte9q1?file=src%2Fmain.ts

Ionic Info

Ionic:

Ionic CLI : 7.2.0

Utility:

cordova-res : not installed globally
native-run : not installed globally

System:

NodeJS : v20.18.3
npm : 11.1.0
OS : Windows 10

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Mar 14, 2025
@brandyscarney brandyscarney added the type: bug a confirmed bug report label Apr 3, 2025
@ionitron-bot ionitron-bot bot removed the triage label Apr 3, 2025
github-merge-queue bot pushed a commit that referenced this issue Apr 4, 2025
Issue number: resolves #30255

---------

## What is the current behavior?
`LogLevel` is not properly exported

## What is the new behavior?
Exports `LogLevel` in core

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

## Other information

Dev build: `8.5.4-dev.11743715474.1eadbd25`

Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
@5im0n
Copy link
Contributor Author

5im0n commented Apr 10, 2025

Thank you @brandyscarney for the resolution! 🙏

However, there's a small issue with the way LogLevel is exported in @ionic/core. It's currently declared as a const enum, which causes problems when using the isolatedModules option in tsconfig.json.

According to the TypeScript documentation, const enums are not supported with isolatedModules enabled:
https://www.typescriptlang.org/docs/handbook/enums.html#const-enum-pitfalls

For example, the following code will fail to compile:

import { IonicConfig, LogLevel } from '@ionic/core';

export const ionicConfig: IonicConfig = {
  logLevel: LogLevel.ERROR, // ❌ Error: Cannot access ambient const enums when 'isolatedModules' is enabled
};

Would it be possible to switch LogLevel to a regular enum instead of a const enum in the package?

Thanks again

@brandyscarney
Copy link
Member

Thank you for letting me know @5im0n! Could you test out this dev build and let me know if you see any other issues? 8.5.5-dev.11744729748.174bf7e0

@5im0n
Copy link
Contributor Author

5im0n commented Apr 16, 2025

🎉 @brandyscarney Thank you for the update! I tested the dev build 8.5.5-dev.11744729748.174bf7e0, and everything seems to be working fine on my end. Great job!

@brandyscarney
Copy link
Member

@5im0n Thanks for the quick reply! Version 8.5.5 was just released with this fix. Please make a new issue if you find anything else. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants