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

images plugin 1.8.0-beta.7 is missing built files #163

Open
markjaquith opened this issue Jul 29, 2022 · 2 comments
Open

images plugin 1.8.0-beta.7 is missing built files #163

markjaquith opened this issue Jul 29, 2022 · 2 comments

Comments

@markjaquith
Copy link
Contributor

If you look at the images plugin fetched via npm, it's missing files in the build/workers directory.

❯ ls @elderjs/plugin-images/build
index.js  index.mjs

But if you look at the markdown plugin, its utils directory is there.

❯ ls @elderjs/plugin-markdown/build
index.cjs  index.d.ts index.js   utils

Of note: the images plugin is not "type": "module". If you convert it to that, you'll have to fix the use of __dirname to use ESM-friendly stuff. Not sure if just doing that is enough to fix the build issue, or if something else is going on.

@nickreese
Copy link
Contributor

@markjaquith This is an issue with tsup's default configured bundling. Because it only bundles obvious imports the way the workers are imported the files weren't detected.

I shipped a potential fix in 1.8.0-beta.8 that should work with cjs assuming the bundling works. Will be testing it on our cjs projects.

@markjaquith
Copy link
Contributor Author

@nickreese The files are there now, but now I'm getting this:

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/mark/Sites/markjaquith.com/node_modules/@elderjs/plugin-images/build/workers/resize.js from /Users/mark/Sites/markjaquith.com/node_modules/worker-nodes/lib/worker/child-loader.js not supported.
Instead change the require of resize.js in /Users/mark/Sites/markjaquith.com/node_modules/worker-nodes/lib/worker/child-loader.js to a dynamic import() which is available in all CommonJS modules.
    at setupModule (/Users/mark/Sites/markjaquith.com/node_modules/worker-nodes/lib/worker/child-loader.js:11:15)
    at MessagePort.<anonymous> (/Users/mark/Sites/markjaquith.com/node_modules/worker-nodes/lib/worker/child-loader.js:88:20) {
  code: 'ERR_REQUIRE_ESM'
}

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

2 participants