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

Nextjs Critical dependency: the request of a dependency is an expression #1287

Open
xxxuyifei opened this issue Jan 25, 2024 · 3 comments
Open

Comments

@xxxuyifei
Copy link

xxxuyifei commented Jan 25, 2024

"next": 13.5.5
"ali-oss": 6.20.0


您好, 最近在Nextjs中使用Aliyun oss 的 browser.js 模块, 报错如下( 不影响正常运行 ), 请教一下怎么解决可以消除异常?


./node_modules/any-promise/register.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/any-promise/register.js
./node_modules/any-promise/index.js
./node_modules/urllib/lib/urllib.js
./node_modules/urllib/lib/index.js
./node_modules/ali-oss/lib/client.js
./src/hooks/useAliyunOSS.ts

./node_modules/vm2/lib/compiler.js
Module not found: Can't resolve 'coffee-script' in 'D:\Project\xxxxx\node_modules\vm2\lib'

Import trace for requested module:
./node_modules/vm2/lib/compiler.js
./node_modules/vm2/lib/script.js
./node_modules/vm2/lib/main.js
./node_modules/vm2/index.js
./node_modules/degenerator/dist/src/index.js
./node_modules/pac-resolver/dist/index.js
./node_modules/pac-proxy-agent/dist/agent.js
./node_modules/pac-proxy-agent/dist/index.js
./node_modules/proxy-agent/index.js
./node_modules/urllib/lib/detect_proxy_agent.js
./node_modules/urllib/lib/urllib.js
./node_modules/urllib/lib/index.js
./node_modules/ali-oss/lib/client.js
./src/hooks/useAliyunOSS.ts

./node_modules/vm2/lib/resolver-compat.js
Critical dependency: the request of a dependency is an expression

Import trace for requested module:
./node_modules/vm2/lib/resolver-compat.js
./node_modules/vm2/lib/main.js
./node_modules/vm2/index.js
./node_modules/degenerator/dist/src/index.js
./node_modules/pac-resolver/dist/index.js
./node_modules/pac-proxy-agent/dist/agent.js
./node_modules/pac-proxy-agent/dist/index.js
./node_modules/proxy-agent/index.js
./node_modules/urllib/lib/detect_proxy_agent.js
./node_modules/urllib/lib/urllib.js
./node_modules/urllib/lib/index.js
./node_modules/ali-oss/lib/client.js
./src/hooks/useAliyunOSS.ts
@jackhutu
Copy link

jackhutu commented May 8, 2024

请问解决了吗, 我也遇到了

@william0619
Copy link

我也是同样的问题

@minisola
Copy link

一样的问题,既然不影响正常运行,我直接配置忽略掉了

const nextConfig = {
  webpack: (config,) => {
    // 忽略特定的警告
    config.ignoreWarnings = [
      {
        message: /Can't resolve 'coffee-script'/,
      },
    ];
    return config;
  },
}

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