Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/with-vanilla-js/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<meta charset="utf-8" />
<link rel="icon" type="image/x-icon" href="./public/favicon.ico">
<title>@web3-onboard with vanilla js</title>
<script defer src="dist/bundle.js"></script>
<script defer src="/runtime.js"></script>
<script defer src="/main.js"></script>
</head>
<body>
<main class="main">
Expand Down
10 changes: 10 additions & 0 deletions examples/with-vanilla-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,18 @@
"author": "",
"license": "ISC",
"devDependencies": {
"assert": "^2.0.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"css-loader": "^6.7.3",
"https-browserify": "^1.0.0",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"style-loader": "^3.3.2",
"util": "^0.12.5",
"webpack": "^5.79.0",
"webpack-cli": "^5.0.2",
"webpack-dev-server": "^4.13.3"
Expand Down
4 changes: 2 additions & 2 deletions examples/with-vanilla-js/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const addConnectedInfo = connectedAccount => {

$connect.addEventListener('click', async _ => {
const wallets = await connect()
const connectedAccount = wallets[0].accounts[0]
label = wallets[0].label
if (wallets[0]) {
const connectedAccount = wallets[0].accounts[0]
label = wallets[0].label
addConnectedInfo(connectedAccount)
$wallet.classList.remove('hidden')
$disconnected.classList.add('hidden')
Expand Down
26 changes: 26 additions & 0 deletions examples/with-vanilla-js/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require('path')
const webpack = require('webpack')

module.exports = {
entry: './src/index.js',
Expand All @@ -7,6 +8,25 @@ module.exports = {
path: path.resolve(__dirname, 'dist'),
clean: true
},
resolve: {
fallback: {
path: require.resolve('path-browserify')
},
alias: {
assert: 'assert',
buffer: 'buffer',
crypto: 'crypto-browserify',
http: 'stream-http',
https: 'https-browserify',
os: 'os-browserify/browser',
process: 'process/browser',
stream: 'stream-browserify',
util: 'util'
}
},
experiments: {
asyncWebAssembly: true
},
module: {
rules: [
{
Expand All @@ -21,6 +41,12 @@ module.exports = {
}
]
},
plugins: [
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer']
})
],
devServer: {
historyApiFallback: true,
static: { directory: path.join(__dirname, '/') },
Expand Down