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

Nuxt2 is compiled with the v5 version and the import.meta syntax is not supported #6362

Closed
citrusjunoss opened this issue Sep 24, 2024 · 3 comments

Comments

@citrusjunoss
Copy link

Describe the bug / 问题描述

nuxt2 使用v5 版本编译报错,import.meta 语法不支持。

babel 已经添加了插件,

"plugins": ["@babel/plugin-syntax-import-meta"]

Reproduction link / 重现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

ERROR in ./node_modules/@antv/layout/lib/supervisor.js friendly-errors 10:17:54

Module parse failed: Unexpected token (78:46) friendly-errors 10:17:54
File was processed with these loaders:

  • ./node_modules/cache-loader/dist/cjs.js
  • ./node_modules/thread-loader/dist/cjs.js
  • ./node_modules/babel-loader/lib/index.js
    You may need an additional loader to handle the result of these loaders.
    | this.proxy = Comlink.wrap(
    | // @ts-ignore
  new Worker(new URL('./worker.js', import.meta.url), {

| type: 'module'
| }));
friendly-errors 10:17:54
@ ./node_modules/@antv/layout/lib/index.js 6:0-29 6:0-29

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

webpack 4.x
babel-core 7.x

@github-actions github-actions bot changed the title nuxt2 使用v5 版本编译报错,import.meta 语法不支持 Nuxt2 is compiled with the v5 version and the import.meta syntax is not supported Sep 24, 2024
@Aarebecca
Copy link
Contributor

使用 webpack 插件:@open-wc/webpack-import-meta-loader

@ChenKun1997
Copy link
Contributor

ChenKun1997 commented Dec 6, 2024

使用 webpack 插件:@open-wc/webpack-import-meta-loader

用了之后又出现新问题了,有解法吗
@Aarebecca @citrusjunoss
image

@Jeh-Chen
Copy link

Jeh-Chen commented Jan 6, 2025

使用webpack 插件:@babel/core @babel/preset-env @babel/preset-react@babel/plugin-proposal-decorators babel-loader @babel/plugin-proposal-class-properties
@ChenKun1997

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants