GithubHelp home page GithubHelp logo

Comments (9)

coder-hxl avatar coder-hxl commented on May 11, 2024 1

@wencaizhang 对的,可以给 package.json 添加 "type": "module",tsconfig.json 添加 "module": "ESNext", "moduleResolution": "Bundler",

from x-crawl.

github-actions avatar github-actions commented on May 11, 2024

Message that will be displayed on users' first issue

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

你好,请打印一下 xCrawl 看看是否存在

from x-crawl.

wencaizhang avatar wencaizhang commented on May 11, 2024

@coder-hxl 你好,我也遇到了同样的问题,我是引入到 nestjs 项目中出现这个情况的,这里有一个复现仓库:

https://github.com/wencaizhang/nestjs-crawl-bug-demo

  • Node 版本:v20.10.0
  • pnpm 版本:8.11.0
  • x-crawl:^10.0.1

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

@wencaizhang 建议提个新的 Issues ,新版改动还是蛮大的,我先克隆下来试试

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

@wencaizhang V10 版本已经不再支持 CJS ,只能使用 ESM ,https://github.com/coder-hxl/x-crawl/releases/tag/v10.0.0
image

from x-crawl.

wencaizhang avatar wencaizhang commented on May 11, 2024

@wencaizhang V10 版本已经不再支持 CJS ,只能使用 ESM ,https://github.com/coder-hxl/x-crawl/releases/tag/v10.0.0 image

这个项目是支持 ESM 的,例如 import { log } from '../utils'; 按照 ESM 写法都是正常的。

但是具体到 x-crawl 我怎么写都不对。

from x-crawl.

coder-hxl avatar coder-hxl commented on May 11, 2024

@wencaizhang 最终打包是变成 CJS 的,可以看看 dist 目录下的文件
image

from x-crawl.

wencaizhang avatar wencaizhang commented on May 11, 2024

明白了,我的理解是现在 nestjs 中虽然是 ESM 写法:

import { createCrawl } from 'x-crawl';

但是实际仍然请求了 x-crawl 的 CJS 模块:
image
而这个模块只输出一个警告信息。

所以真正的问题应该是如何让 nestjs 引入 x-crawl 的 ESM 模块了。

from x-crawl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.