-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2ee69e
commit 63bcd0e
Showing
7 changed files
with
1,544 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import React from 'react'; | ||
import { Staking } from '@lace/staking'; | ||
|
||
export const App = () => { | ||
return ( | ||
<> | ||
<h1>Embed Staking</h1> | ||
<Staking theme="light" /> | ||
</> | ||
) | ||
} | ||
const App = () => ( | ||
<> | ||
<h1>Embed Staking</h1> | ||
<Staking theme="light" /> | ||
</> | ||
); | ||
|
||
export default App | ||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
export default defineConfig({ | ||
plugins: [react()], | ||
build: { | ||
lib: { | ||
entry: './src/main.tsx', | ||
name: 'poc-app', | ||
fileName: (format) => `poc-app.${format}.js`, | ||
formats: ['es', 'umd'], | ||
name: 'staking-app', | ||
fileName: (format) => `staking-app.${format}.js`, | ||
formats: ['es', 'umd'] | ||
}, | ||
outDir: 'dist', | ||
rollupOptions: { | ||
external: ['react', 'react-dom'], | ||
external: ['react', 'react-dom', 'get-port-please', '@cardano-sdk/util-dev'], | ||
input: './src/main.tsx', | ||
output: { | ||
globals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM', | ||
}, | ||
}, | ||
'react-dom': 'ReactDOM' | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
const path = require('path'); | ||
const { NormalModuleReplacementPlugin, ProvidePlugin, IgnorePlugin, EnvironmentPlugin, experiments } = require('webpack'); | ||
|
||
module.exports = { | ||
mode: 'production', | ||
entry: './src/main.tsx', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: 'bundle.js', | ||
library: 'staking', // Name of the global variable for the UMD build | ||
libraryTarget: 'umd', // Universal Module Definition for compatibility | ||
globalObject: 'this', // Fix for environments where `window` is undefined | ||
}, | ||
externals: { | ||
react: 'react', // Avoid bundling React | ||
'react-dom': 'react-dom', // Avoid bundling ReactDOM | ||
}, | ||
experiments: { | ||
asyncWebAssembly: true, | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
use: [ | ||
'style-loader', | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
importLoaders: 1, | ||
modules: true | ||
} | ||
} | ||
], | ||
include: /\.module\.css$/ | ||
}, | ||
{ | ||
test: /\.css$/, | ||
use: ['style-loader', 'css-loader'], | ||
exclude: /\.module\.css$/ | ||
}, | ||
{ | ||
exclude: /node_modules/, | ||
test: /\.scss$/, | ||
use: [ | ||
'style-loader', | ||
'css-loader', | ||
'sass-loader' | ||
] | ||
}, | ||
{ | ||
test: /^[.]*(?!.*\.component\.svg$).*\.svg*$/, | ||
use: 'file-loader' | ||
}, | ||
{ | ||
test: /component\.svg(\?v=\d+\.\d+\.\d+)?$/, | ||
use: [ | ||
{ | ||
loader: '@svgr/webpack', | ||
options: { | ||
icon: true | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.(eot|otf|ttf|woff|woff2|gif|png|webm|mp4)$/, | ||
loader: 'file-loader' | ||
}, | ||
{ | ||
test: /packages\/.+\/dist\/.+\.js$/, | ||
enforce: 'pre', | ||
use: ['source-map-loader'] | ||
}, | ||
{ | ||
test: /\.(js|jsx|ts|tsx)$/, | ||
exclude: /node_modules\/(?!(@cardano-sdk)\/).*/, | ||
loader: 'swc-loader', | ||
options: { | ||
jsc: { | ||
parser: { | ||
syntax: 'typescript', | ||
tsx: true | ||
}, | ||
target: 'es2019', | ||
loose: false | ||
} | ||
}, | ||
resolve: { | ||
fullySpecified: false | ||
} | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.tsx', '.js'], | ||
fullySpecified: false, | ||
fallback: { | ||
https: require.resolve('https-browserify'), | ||
http: require.resolve('stream-http'), | ||
'get-port-please': false, | ||
net: false, | ||
fs: false, | ||
os: false, | ||
path: false, | ||
events: require.resolve('events/'), | ||
buffer: require.resolve('buffer/'), | ||
stream: require.resolve('readable-stream'), | ||
crypto: require.resolve('crypto-browserify'), | ||
constants: require.resolve('constants-browserify'), | ||
zlib: require.resolve('browserify-zlib'), | ||
dns: false, | ||
tls: false, | ||
process: false, | ||
child_process: false | ||
}, | ||
}, | ||
plugins: [ | ||
new NormalModuleReplacementPlugin(/blake2b$/, 'blake2b-no-wasm'), | ||
new NormalModuleReplacementPlugin(/@emurgo\/cip14-js/, path.join(__dirname, './src/utils/cip14.js')), | ||
new NormalModuleReplacementPlugin( | ||
/@emurgo\/cardano-message-signing-nodejs/, | ||
'@emurgo/cardano-message-signing-browser' | ||
), | ||
new ProvidePlugin({ | ||
Buffer: ['buffer', 'Buffer'], | ||
process: 'process/browser' | ||
}), | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.