We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
On a fresh SvelteKit project we are unable to use import.meta.env in JS files due to an ESLint error:
import.meta.env
1:13 error Parsing error: Unexpected token import ✖ 1 problem (1 error, 0 warnings)
Bumping ecmaVersion to 2020 fixes this issue.
npm init svelte@next my-app
src/lib/my-file.js
// src/lib/my-file.js console.log(import.meta.env)
pnpm eslint src/lib/my-file.js
unexpected token import
module.exports = { root: true, extends: ['eslint:recommended', 'prettier'], plugins: ['svelte3'], overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], parserOptions: { sourceType: 'module', - ecmaVersion: 2019 + ecmaVersion: 2020 }, env: { browser: true, es2017: true, node: true } }
Previously I had just used babel-eslint for the parser, however upon further investigation simply bumping the ecmaVersion mitigates the issue
ecmaVersion
nice to have
It is worth noting we can use import.meta.env regardless of ecmaVersion while building our SvelteKit site, however this issue only arises during lint.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the problem
On a fresh SvelteKit project we are unable to use
import.meta.env
in JS files due to an ESLint error:Bumping ecmaVersion to 2020 fixes this issue.
Reproduction
npm init svelte@next my-app
, use ESLintsrc/lib/my-file.js
with the following contentpnpm eslint src/lib/my-file.js
unexpected token import
Describe the proposed solution
Alternatives considered
Previously I had just used babel-eslint for the parser, however upon further investigation simply bumping the
ecmaVersion
mitigates the issueImportance
nice to have
Additional Information
It is worth noting we can use
import.meta.env
regardless ofecmaVersion
while building our SvelteKit site, however this issue only arises during lint.The text was updated successfully, but these errors were encountered: