question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot access ambient const enums when the '--isolatedModules' flag is provided.

See original GitHub issue

Describe the bug

Error when build with @fluentui/react:

$ tsc && vite build
node_modules/@fluentui/font-icons-mdl2/lib/IconNames.d.ts:1807:51 - error TS2748: Cannot access ambient const enums when the '--isolatedModules' flag is provided.

1807 export declare type IconNamesInput = keyof typeof IconNames;
                 

Reproduction

I create vite app with react and typescript option. I install @fluentui/react, and just import and display PrimaryButton from it. My app work in dev, but in bulild encounter error.

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  System:
    OS: macOS 11.2.3
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 257.64 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 15.7.0 - ~/.nvm/versions/node/v15.7.0/bin/node
    Yarn: 1.22.10 - ~/.nvm/versions/node/v15.7.0/bin/yarn
    npm: 7.4.3 - ~/.nvm/versions/node/v15.7.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Browsers:
    Chrome: 90.0.4430.93
    Safari: 14.0.3
  npmPackages:
    vite: ^2.2.3 => 2.2.4 

Used package manager:

Logs



Before submitting the issue, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
  • Provide a description in this issue that describes the bug.
  • Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
  • Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
CHOYSENcommented, May 17, 2021

This may relate with https://github.com/microsoft/fluentui/issues/7110

when I set skipLibCheck into true, to ignore this error, other error occurred:

I clone your repo and run vite build after setting skipLibCheck:true, it work for me.

0reactions
wellbeck190commented, May 17, 2021

@CHOYSEN I tried again with “skipLibCheck: true”, it worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot access ambient const enums when the ...
Describe the bug Even with a minimal setup, vue-tsc fire errors when isolatedModules flag is active Reproduction ...
Read more >
Why is `const enum` allowed with `isolatedModules`?
error TS1209 : Ambient const enums are not allowed when the '--isolatedModules' flag is provided. My understanding of --isolatedModules is that ...
Read more >
Cannot access ambient const enums (when using create react ...
I am trying to import an enum 'XRHandJoint', but I get a compilation error 'Cannot access ambient const enums when the '–isolatedModules' ...
Read more >
isolatedModules - TSConfig Option - TypeScript
Setting the isolatedModules flag tells TypeScript to warn you if you ... isolatedModules is set, it is an error to reference an ambient...
Read more >
vite报错Cannot access ambient const enums when the
build时报错: Cannot access ambient const enums when the '–isolatedModules' flag is provided.26 readonly [ReactiveFlags.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found