-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
[Bug] shipped .mjs
bundle includes reference to __dirname
#79
Comments
.mjs
bundle includes reference to __dirname
.mjs
bundle includes reference to __dirname
.mjs
bundle includes reference to __dirname
.mjs
bundle includes reference to __dirname
We could use this https://antfu.me/notes#isomorphic-dirname, PR welcome! |
@josh-hemphill can you test with new version |
Still getting it. ReferenceError: __dirname is not defined
at vueuse_core_default (file:///C:/Users/joshua/test/node_modules/unplugin-auto-import/dist/chunk-7XNAUYVJ.mjs:289:87)
at file:///C:/Users/joshua/test/node_modules/unplugin-auto-import/dist/chunk-C7LMGRZJ.mjs:42:51
at Array.forEach (<anonymous>)
at flattenImportsMap (file:///C:/Users/joshua/test/node_modules/unplugin-auto-import/dist/chunk-C7LMGRZJ.mjs:37:16)
at resolveOptions (file:///C:/Users/joshua/test/node_modules/unplugin-auto-import/dist/chunk-C7LMGRZJ.mjs:18:19)
at file:///C:/Users/joshua/test/node_modules/unplugin-auto-import/dist/chunk-C7LMGRZJ.mjs:181:20
at file:///C:/Users/joshua/test/node_modules/unplugin/dist/index.mjs:53:23
at file:///C:/Users/joshua/test/vite.config.ts.js?t=1637687311754:72:5
at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
at async Loader.import (node:internal/modules/esm/loader:178:24) /* unplugin-auto-import/dist/chunk-7XNAUYVJ.mjs:289:87 */
// src/presets/vueuse-core.ts
import resolve from "resolve";
var _cache;
var vueuse_core_default = () => {
const excluded = ["toRefs", "utils"];
if (!_cache) {
try {
const path = resolve.sync("@vueuse/core/indexes.json", { paths: [process.cwd(), __dirname] }); |
I had to uninstall and reinstall. Now it works. Thanks! |
Now I'm getting another, I can open another issue if you like, but I thought I'd post here first since it's along the same vein. failed to load config from C:\Users\joshua\test\vite.config.ts
Error: Dynamic require of "os" is not supported
at __require (file:///C:/Users/joshua/test/node_modules/vite-plugin-inspect/dist/index.mjs:26:9)
at node_modules/.pnpm/[email protected]/node_modules/supports-color/index.js (file:///C:/Users/joshua/test/node_modules/vite-plugin-inspect/dist/index.mjs:1156:14)
at __require2 (file:///C:/Users/joshua/test/node_modules/vite-plugin-inspect/dist/index.mjs:29:44)
at node_modules/.pnpm/[email protected]/node_modules/chalk/source/index.js (file:///C:/Users/joshua/test/node_modules/vite-plugin-inspect/dist/index.mjs:1412:56)
at __require2 (file:///C:/Users/joshua/test/node_modules/vite-plugin-inspect/dist/index.mjs:29:44)
at file:///C:/Users/joshua/test/node_modules/vite-plugin-inspect/dist/index.mjs:34444:31
at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
at async Loader.import (node:internal/modules/esm/loader:178:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:437:15)
at async loadConfigFromFile (C:\Users\joshua\test\node_modules\vite\dist\node\chunks\dep-e0fe87f8.js:68598:31) |
@josh-hemphill it seems the problem is on |
Oh, yep. Sorry about that. |
Issue created on |
__dirname
is not available in ES modules.Had to switch my project to ESM for another dependency and this came up as an error.
I'm not clear on how files are handled, but maybe it's not respecting the
from the
package.json
of auto-imported modulesThe text was updated successfully, but these errors were encountered: