Skip to content

Commit

Permalink
Merge pull request #273 from radixdlt/single-file-bundle
Browse files Browse the repository at this point in the history
code(rdt): update single file bundle extension
  • Loading branch information
xstelea authored Nov 11, 2024
2 parents d831bad + db3fbf2 commit 0fc6024
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ yarn-error.log*

.envrc

examples/cdn/radix-dapp-toolkit.bundle.umd.cjs
examples/cdn/radix-dapp-toolkit.bundle.umd.js

# Editor directories and files
.vscode/*
Expand Down
4 changes: 2 additions & 2 deletions examples/cdn/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<header><radix-connect-button /></header>
<div id="app"></div>

<script src="./radix-dapp-toolkit.bundle.umd.cjs"></script>
<script src="./radix-dapp-toolkit.bundle.umd.js"></script>
<script>
const rdt = window.RDT.RadixDappToolkit({
dAppDefinitionAddress:
Expand All @@ -25,7 +25,7 @@
applicationVersion: '1.0.0',
logger: window.RDT.Logger(1),
})
console.log(rdt);
console.log(rdt)
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion packages/dapp-toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"scripts": {
"dev": "tsup --watch",
"build": "tsup && npm run build:single",
"build:single": "vite build --config vite-single-file.config.ts && cp dist/radix-dapp-toolkit.bundle.umd.cjs ../../examples/cdn",
"build:single": "vite build --config vite-single-file.config.ts && cp dist/radix-dapp-toolkit.bundle.umd.js ../../examples/cdn",
"test": "vitest run --coverage",
"test:watch": "vitest --watch"
},
Expand Down
8 changes: 8 additions & 0 deletions packages/dapp-toolkit/vite-single-file.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ import { viteSingleFile } from 'vite-plugin-singlefile'

export default defineConfig({
plugins: [viteSingleFile()],

build: {
emptyOutDir: false,

lib: {
entry: 'src/single-file.js',
name: 'RDT',
fileName: 'radix-dapp-toolkit.bundle',
formats: ['umd'],
},
rollupOptions: {
output: {
entryFileNames: `radix-dapp-toolkit.bundle.umd.js`,
},
},
},
define: { 'process.env.NODE_ENV': '"production"' },
Expand Down

0 comments on commit 0fc6024

Please sign in to comment.