Skip to content

Commit

Permalink
🔄 synced local 'examples/' with remote 'examples/'
Browse files Browse the repository at this point in the history
circle-github-action-bot committed Aug 30, 2024
1 parent c47dd12 commit 736b3a5
Showing 6 changed files with 67 additions and 13 deletions.
5 changes: 4 additions & 1 deletion examples/js-example/package.json
Original file line number Diff line number Diff line change
@@ -4,10 +4,13 @@
"main": "index.js",
"license": "MIT",
"dependencies": {
"@circle-fin/w3s-pw-web-sdk": "^1.0.0",
"@circle-fin/w3s-pw-web-sdk": "^1.1.1",
"buffer": "^6.0.3",
"html-webpack-plugin": "^5.5.3",
"jquery": "^3.7.1",
"live-server": "^1.2.2",
"node-polyfill-webpack-plugin": "^4.0.0",
"process": "^0.11.10",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
11 changes: 11 additions & 0 deletions examples/js-example/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')

module.exports = {
entry: './src/index.js',
@@ -16,7 +17,17 @@ module.exports = {
$: 'jquery',
jQuery: 'jquery',
}),
new NodePolyfillPlugin(),
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
})
],
resolve: {
alias: {
process: 'process/browser',
},
},
devServer: {
static: {
directory: path.join(__dirname, 'dist'),
30 changes: 30 additions & 0 deletions examples/react-example/config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const webpack = require('webpack')

module.exports = function override(config) {
const fallback = config.resolve.fallback || {}

Object.assign(fallback, {
buffer: require.resolve('buffer/'),
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
util: require.resolve('util/'),
vm: require.resolve('vm-browserify'),
'process/browser': require.resolve('process/browser'),
})

config.resolve.fallback = fallback
config.plugins = (config.plugins || []).concat([
new webpack.ProvidePlugin({
process: 'process/browser',
Buffer: ['buffer', 'Buffer'],
}),
])
config.module.rules.unshift({
test: /\.m?js$/,
resolve: {
fullySpecified: false,
},
})

return config
}
17 changes: 12 additions & 5 deletions examples/react-example/package.json
Original file line number Diff line number Diff line change
@@ -3,18 +3,25 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@circle-fin/w3s-pw-web-sdk": "^1.0.0",
"@circle-fin/w3s-pw-web-sdk": "^1.1.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"process": "^0.11.10",
"react": "^18.3.1",
"react-app-rewired": "^2.2.1",
"react-dom": "^18.3.1",
"react-scripts": "5.0.1",
"stream-browserify": "^3.0.0",
"util": "^0.12.5",
"vm-browserify": "^1.1.2",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
5 changes: 4 additions & 1 deletion examples/vue-example/package.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,10 @@
"preview": "vite preview"
},
"dependencies": {
"@circle-fin/w3s-pw-web-sdk": "^1.0.0",
"@circle-fin/w3s-pw-web-sdk": "^1.1.1",
"buffer": "^6.0.3",
"process": "^0.11.10",
"vite-plugin-node-polyfills": "^0.22.0",
"vue": "^3.2.47"
},
"devDependencies": {
12 changes: 6 additions & 6 deletions examples/vue-example/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { nodePolyfills } from 'vite-plugin-node-polyfills'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
plugins: [nodePolyfills(), vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
})

0 comments on commit 736b3a5

Please sign in to comment.