Fix exports of ogv-support.js
/ogv-version.js
+ some JS build clean-up
#620
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main reason for this PR is to fix the issue where the compiled
ogv-support.js
andogv-version.js
files don't actually export anything, where you'd expect theOGVCompat
andOGVVersion
exports. In fact, these files would only assign those values to the global object.I've fixed this by specifying the
output.library.type: 'umd'
option for these entries in the webpack config. This will make the exports work as expected in AMD/CommonJS module environments.Additionally, by omitting
output.library.name
, the exports will be assigned directly to thewindow
object when loaded in a<script>
tag. Therefore, I've also removed the explicitwindow
-assignments from the main three entrypoints.See also: https://webpack.js.org/configuration/output/#type-umd
Other small changes to the JS build:
prepublish
script toprepack
, somake -j4 dist
only runs beforenpm pack
/npm publish
and NOT fornpm install
. This might require a change in the README. If you disagree with this change, I suggest changing it toprepare
instead as per https://docs.npmjs.com/cli/v9/using-npm/scripts#prepare-and-prepublish.package-lock.json
afternpm install
.mode
is now specified per-script inpackage.json
, allowing for development mode builds while developing.