Skip to content

Commit

Permalink
Fix browser bundling example
Browse files Browse the repository at this point in the history
  • Loading branch information
atoppi committed Feb 28, 2024
1 parent 1090ff4 commit 7b976c9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/browser/bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default {
EOF

cat <<EOF > config.js
import replace from '@rollup/plugin-replace';
import nodePolyfills from 'rollup-plugin-polyfill-node';
import nodeResolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
Expand All @@ -35,14 +36,19 @@ export default {
name: '$EXPORTED_OBJECT'
},
plugins: [
replace({
preventAssignment: false,
"import UnixTransport from './transport-unix.js'" : "function UnixTransport() { this.open = _ => Logger.error('unix-dgram unsupported on browsers')}",
delimiters: ['', '']
}),
nodePolyfills(),
nodeResolve({ browser: true }),
commonjs()
]
};
EOF

npm install --no-save rollup-plugin-polyfill-node @rollup/plugin-node-resolve @rollup/plugin-commonjs
npm install --no-save @rollup/plugin-replace rollup-plugin-polyfill-node @rollup/plugin-node-resolve @rollup/plugin-commonjs
rollup --config config.js

cp ./app/*.* $DEPLOY_DIR
Expand Down

0 comments on commit 7b976c9

Please sign in to comment.