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

Yarn 2 and 3 PNP Support #130

Closed
DavidArchibald opened this issue Feb 15, 2022 · 0 comments · Fixed by #131
Closed

Yarn 2 and 3 PNP Support #130

DavidArchibald opened this issue Feb 15, 2022 · 0 comments · Fixed by #131

Comments

@DavidArchibald
Copy link
Contributor

It seems that ES6 style imports currently does not work with some combination of Gulp, Yarn 2/3, and ES6 imports. I can get this issue with the following steps:

$ npx @ghost-fvtt/foundry-factory -m yarn2 --default --type module --no-config test
$ cd test
$ yarn build

Got error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'fs-extra' imported from [path]/test/gulpfile.js
Did you mean to import fs-extra-npm-10.0.0-4f8c704115-5285a3d8f3.zip/node_modules/fs-extra/lib/index.js?
    at new NodeError (node:internal/errors:371:5)
    at packageResolve (node:internal/modules/esm/resolve:930:9)
    at moduleResolve (node:internal/modules/esm/resolve:976:18)
    at defaultResolve (node:internal/modules/esm/resolve:1078:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

The suggested import fs-extra-npm-10.0.0-4f8c704115-5285a3d8f3.zip seems to be clearly referring to the .yarn/cache file of the same name. It's somewhat peculiar it recognizes the PNP module exists. I tracked down this issue as well as this e2e test.

I currently have it working by converting it to .cjs and changing the imports to match.

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

Successfully merging a pull request may close this issue.

1 participant