-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
[vite-typescript] how to use 'import.meta' #3317
Comments
You can try this! {
"compilerOptions": {
- "module": "commonjs",
+ "module": "ESNext",
}
} 🤔 However this seems to conflict here 👉 #3178 (comment) |
Then when compiling with vite,i cannot use 'import.meta'.Is that so? |
@w3cways How did you finally solve this problem? |
{ |
What is the expected way to do this now? I followed the setup using EDIT: I had left Removing it and going with @w3cways solution worked |
Pre-flight checklist
Electron Forge version
6.4.1
Electron version
26.0.0
Operating system
macOS 12.4
Last known working Electron Forge version
none
Expected behavior
when I use 'import.meta' in renderer.ts, prompt error :'The "import.meta" meta property is only allowed when the "--module" option is "es2020", "es2022", "esnext", "system", "node16", or "nodenext"'
tsconfig.json
{ "compilerOptions": { "target": "ESNext", "module": "commonjs", "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "noImplicitAny": true, "sourceMap": true, "baseUrl": ".", "outDir": "dist", "moduleResolution": "node", "resolveJsonModule": true }, "include": ["src"] }
if I change 'commonjs' to 'ESNext', then run command 'npm run start', got errors:
An unhandled rejection has occurred inside Forge: SyntaxError: Cannot use import statement outside a module
Is there a way to fix this?
Actual behavior
can use 'import.meta' in [vite-typescript]
Steps to reproduce
Additional information
No response
The text was updated successfully, but these errors were encountered: