-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Describe the bug
Chat.js is throwing the following error when running with vite 3.0.0 / sveltekit 1.0.0-next.374
(node:173691) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Cannot use import statement outside a module
/home/alex/Downloads/chartTest/node_modules/.pnpm/[email protected]/node_modules/chart.js/auto/auto.esm.js:1
import {Chart, registerables} from '../dist/chart.esm.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
The exact same code was working with:
@sveltejs/kit: 1.0.0-next.372
vite: 2.9.14
Reproduction
- clone Repository https://github.com/Cluster2a/chartjsError
- pnpm install
- pnpm run dev
Logs
(node:173691) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Cannot use import statement outside a module
/home/alex/Downloads/chartTest/node_modules/.pnpm/[email protected]/node_modules/chart.js/auto/auto.esm.js:1
import {Chart, registerables} from '../dist/chart.esm.js';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:168:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:337:24)System Info
System:
OS: Linux 5.15 Ubuntu 22.04 LTS 22.04 LTS (Jammy Jellyfish)
CPU: (16) x64 Intel(R) Core(TM) i9-9900KS CPU @ 4.00GHz
Memory: 2.53 GB / 15.54 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.4.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
Browsers:
Chrome: 102.0.5005.115
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.60
@sveltejs/kit: 1.0.0-next.374 => 1.0.0-next.374
svelte: ^3.49.0 => 3.49.0
vite: ^3.0.0 => 3.0.0Severity
blocking an upgrade
Additional Information
No response