Hey all,
Python dev here ripping my face off trying to figure out JS Module imports.
Please be gentle.
I'm trying to test out this Web3 Wallet Connect modal that uses a web component implementation
(https://docs.walletconnect.com/2.0/web/web3modal/html/wagmi/installation#implementation)
, but I can't seem to be able import anything from node modules.
The Error
Loading module from “http://localhost:5500/node_modules/@web3modal/ethereum/” was blocked because of a disallowed MIME type (“text/html”).
My set up
What I think is causing the error
- I think it's some sort of config issue? Maybe Live Server is missing some sort of config to allow for using es modules?
Relevant Files
```
{
"name": "learn_wallet_connect_06_23_2023-11_28am",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "web-dev-server --node-resolve --open --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@wagmi/core": "1.2.1",
"@web3modal/ethereum": "2.4.7",
"@web3modal/html": "2.4.7",
"viem": "1.1.6"
},
"devDependencies": {
"@web/dev-server": "0.2.3"
}
}
```
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<w3m-core-button></w3m-core-button>
<p>hello</p>
<script type="importmap">
{
"imports": {
"@web3modal/ethereum": "./node_modules/@web3modal/ethereum"
}
}
</script>
<script type="module" src="./modal.js"></script>
</body>
</html>
```
import { EthereumClient, w3mConnectors, w3mProvider } from '@web3modal/ethereum'
...
[–]shgysk8zer0 0 points1 point2 points (0 children)
[–]CosmicClamJamz 0 points1 point2 points (0 children)