Skip to content
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

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

Closed
6 tasks done
wellbeck190 opened this issue May 10, 2021 · 6 comments · May be fixed by Rafal3232/vite#319
Closed
6 tasks done

Comments

@wellbeck190
Copy link

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.
@wellbeck190
Copy link
Author

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

Cannot read property 'deoptimizePath' of undefined
error during build:
TypeError: Cannot read property 'deoptimizePath' of undefined
    at NamespaceVariable.deoptimizePath (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:4475:34)
    at Identifier.deoptimizePath (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:4064:23)
    at LocalVariable.deoptimizePath (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:2420:23)
    at Identifier.deoptimizePath (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:4064:23)
    at MemberExpression.deoptimizePath (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:6617:25)
    at CallExpression.bind (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:6794:22)
    at Property.bind (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:2723:23)
    at Property.bind (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:8509:15)
    at ObjectExpression.bind (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:2719:31)
    at ObjectExpression.bind (/Users/ws/Workspace/vite-demo/node_modules/rollup/dist/shared/rollup.js:8186:15)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@CHOYSEN
Copy link
Contributor

CHOYSEN commented May 16, 2021

Please provide a repo link that can reproduce this issue.

@github-actions
Copy link

Hello @wellbeck190. Please provide a online reproduction by codesandbox or a minimal GitHub repository. Issues labeled by need reproduction will be closed if no activities in 3 days.

@wellbeck190
Copy link
Author

Reproduction

https://github.com/wellbeck190/vite-react-typescript-fluentui

yarn dev: everything is ok
but, yarn build:

yarn run v1.22.10
warning package.json: No license field
$ 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;
                                                       ~~~~~~~~~


Found 1 error.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@CHOYSEN
Copy link
Contributor

CHOYSEN commented May 17, 2021

This may relate with microsoft/fluentui#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.

@wellbeck190
Copy link
Author

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

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants