Skip to content

[Bug]: SyntaxError: Named export 'deepMix' not found. #126

@ianzone

Description

@ianzone

当在 vite.config.ts 中使用 import { deepMix } from '@antv/util'; 时报错

$ cross-env TZ=Asia/Shanghai vite
failed to load config from /home/ian/osc/G2/vite.config.ts
error when starting dev server:
file:///home/ian/osc/G2/node_modules/.vite-temp/vite.config.ts.timestamp-1746363346287-276b6ca8bed88.mjs:2
import { deepMix } from "file:///home/ian/osc/G2/node_modules/@antv/util/lib/index.js";
         ^^^^^^^
SyntaxError: Named export 'deepMix' not found. The requested module 'file:///home/ian/osc/G2/node_modules/@antv/util/lib/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'file:///home/ian/osc/G2/node_modules/@antv/util/lib/index.js';
const { deepMix } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:182:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:266:5)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
    at async loadConfigFromBundledFile (file:///home/ian/osc/G2/node_modules/vite/dist/node/chunks/dep-Bn81Esdm.js:49416:15)
    at async bundleAndLoadConfigFile (file:///home/ian/osc/G2/node_modules/vite/dist/node/chunks/dep-Bn81Esdm.js:49259:22)
    at async loadConfigFromFile (file:///home/ian/osc/G2/node_modules/vite/dist/node/chunks/dep-Bn81Esdm.js:49222:44)
    at async resolveConfig (file:///home/ian/osc/G2/node_modules/vite/dist/node/chunks/dep-Bn81Esdm.js:48718:24)
    at async _createServer (file:///home/ian/osc/G2/node_modules/vite/dist/node/chunks/dep-Bn81Esdm.js:38329:18)
    at async CAC.<anonymous> (file:///home/ian/osc/G2/node_modules/vite/dist/node/cli.js:753:20)
error: script "dev" exited with code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions