Cannot access ambient const enums when the '--isolatedModules' flag is provided.
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This may relate with https://github.com/microsoft/fluentui/issues/7110
I clone your repo and run
vite build
after settingskipLibCheck:true
, it work for me.@CHOYSEN I tried again with “skipLibCheck: true”, it worked.