-
Notifications
You must be signed in to change notification settings - Fork 420
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
@polkadot/extension-dapp throw errors #1018
Labels
Support
Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Comments
It is a vite issue in this |
jacogr
added
the
Support
Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
label
Mar 8, 2022
fend25
added a commit
to fend25/dev
that referenced
this issue
Mar 18, 2022
…ta.url)` Hi! Vite shows EISDIR error at `new URL('.', import.meta.url)` expression on build. Actually checking import.meta.url is not enough to fix this problem. The problem is when bundler tries to build the code in production build, in compile time it has no idea about how the expression `new URL('.', import.meta.url)` should be resolved in runtime. And it tries to read all the file and bake it inline in base64 form. And in case of `new URL('.', ...)` it tries to read the dir what is impossible and throws compile-time error EISDIR. So I created a workaround code which gives the same output in Vite dev and Node.js environments: ```js const filePathname = new URL(import.meta.url).pathname const folderPathname = filePathname.substring(0, filePathname.lastIndexOf('/')+1) ``` actually does literally the same as ```js new URL('.', import.meta.url) ``` Also closes polkadot-js/extension#1018
fend25
added a commit
to fend25/dev
that referenced
this issue
Mar 18, 2022
…ta.url)` Hi! Vite shows EISDIR error at `new URL('.', import.meta.url)` expression on build. Actually checking import.meta.url is not enough to fix this problem. The problem is when bundler tries to build the code in production build, in compile time it has no idea about how the expression `new URL('.', import.meta.url)` should be resolved in runtime. And it tries to read all the file and bake it inline in base64 form. And in case of `new URL('.', ...)` it tries to read the dir what is impossible and throws compile-time error EISDIR. So I created a workaround code which gives the same output in Vite dev and Node.js environments: ```js const filePathname = new URL(import.meta.url).pathname const folderPathname = filePathname.substring(0, filePathname.lastIndexOf('/')+1) ``` actually does literally the same as ```js new URL('.', import.meta.url) ``` Also closes polkadot-js/extension#1018
jacogr
pushed a commit
to polkadot-js/dev
that referenced
this issue
Mar 18, 2022
…ta.url)` (#637) Hi! Vite shows EISDIR error at `new URL('.', import.meta.url)` expression on build. Actually checking import.meta.url is not enough to fix this problem. The problem is when bundler tries to build the code in production build, in compile time it has no idea about how the expression `new URL('.', import.meta.url)` should be resolved in runtime. And it tries to read all the file and bake it inline in base64 form. And in case of `new URL('.', ...)` it tries to read the dir what is impossible and throws compile-time error EISDIR. So I created a workaround code which gives the same output in Vite dev and Node.js environments: ```js const filePathname = new URL(import.meta.url).pathname const folderPathname = filePathname.substring(0, filePathname.lastIndexOf('/')+1) ``` actually does literally the same as ```js new URL('.', import.meta.url) ``` Also closes polkadot-js/extension#1018
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Support
Tracks issues or requests related to troubleshooting, answering questions, and user assistance.
Hi,
I encountered the following problems when using this package ( "@polkadot/extension-dapp": "^0.42.7",)
vite build
[vite:asset-import-meta-url] EISDIR: illegal operation on a directory, read
file: D:/git-repos/biubiu-tools/node_modules/@polkadot/extension-dapp/packageInfo.js
error during build:
Error: EISDIR: illegal operation on a directory, read
vite dev
Uncaught TypeError: Failed to construct 'URL': Invalid URL
at @polkadot_extension-dapp.js:8227:9
// node_modules/@polkadot/x-global/packageInfo.js
var import_meta = {};
var packageInfo = {
name: "@polkadot/x-global",
path: new URL(".", import_meta.url).pathname,
type: "esm",
version: "8.4.1"
};
This prevents my dapp from accessing the polkadot.js extension wallet, please help
The text was updated successfully, but these errors were encountered: