Produce a bundle that includes all dependencies
Closed this issue ยท 8 comments
Right now, a couple of dependencies are causing issues in the verovio-unroll
branch:
- webaudiofont whose npm package seems incompatible with
webpack
androllup
- SaxonJS whose browser version is not on npm, and whose code is not compatible with modules
They need to be included separately in the hosting HTML to be usable. That's not suitable for a reusable module.
The aim is to produce a bundle that can be included on a web page using a single <script>
invocation without additional inclusions. The demo should be fully functional. It does not matter whether the final bundle is commonjs
or esm
.
I can demonstrate these issues in more detail if anyone is willing to take on this issue.
/bounty 100
๐ $100 bounty created by infojunkie
๐ If you start working on this, comment /attempt #17
to notify everyone
๐ To claim this bounty, submit a pull request that includes the text /claim #17
somewhere in its body
๐ Before proceeding, please make sure you can receive payouts in your country
๐ต Payment arrives in your account 2-5 days after the bounty is rewarded
๐ฏ You keep 100% of the bounty award
๐ Thank you for contributing to infojunkie/musicxml-player!
Attempt | Started | Solution |
---|---|---|
๐ข @deevus | May 17, 2023 | #21 |
Fixed webaudiofont here: deevus@67f9c16
Thanks @deevus for attempting this. I downloaded your branch and ran into the following problems:
$ npm run build
> musicxml-player@0.5.4 build
> rollup --config ./rollup.config.mjs
(node:86232) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
./src/index.ts โ ./dist/musicxml-player.esm.js...
[!] RollupError: "WebAudioFontPlayer" is not exported by "node_modules/webaudiofont/npm/dist/WebAudioFontPlayer.js", imported by "src/WebAudioFontOutput.ts".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module
src/WebAudioFontOutput.ts (2:9)
1: import { AudioContext } from 'standardized-audio-context';
2: import { WebAudioFontPlayer } from 'webaudiofont';
^
Looks like patching is not automated - needs some additional script in package.json
. So I ran:
$ patch -p1 < patches/webaudiofont+3.0.4.patch
patching file node_modules/webaudiofont/npm/dist/WebAudioFontPlayer.js
Hunk #1 FAILED at 1220 (different line endings).
1 out of 1 hunk FAILED -- saving rejects to file node_modules/webaudiofont/npm/dist/WebAudioFontPlayer.js.rej
I tried dos2unix
:
$ dos2unix node_modules/webaudiofont/npm/dist/WebAudioFontPlayer.js
dos2unix: converting file node_modules/webaudiofont/npm/dist/WebAudioFontPlayer.js to Unix format...
$ patch -p1 < patches/webaudiofont+3.0.4.patch
patching file node_modules/webaudiofont/npm/dist/WebAudioFontPlayer.js
$ npm run build
> musicxml-player@0.5.4 build
> rollup --config ./rollup.config.mjs
(node:87693) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
./src/index.ts โ ./dist/musicxml-player.esm.js...
created ./dist/musicxml-player.esm.js in 6s
Then the demo ran!! Great job. I would just ask you to make the process smoother, such that the first npm run build
does the job without further intervention.
@infojunkie Yep I need to automate the patching. My apologies for not being clear on that.
๐ก @deevus submitted a pull request that claims the bounty. You can visit your org dashboard to reward.
๐๐ @deevus has been awarded $100! ๐๐