The main reason for this PR is to fix the issue where the compiled ogv-support.js and ogv-version.js files don't actually export anything, where you'd expect the OGVCompat and OGVVersion 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 the window object when loaded in a <script> tag. Therefore, I've also removed the explicit window-assignments from the main three entrypoints.
Changed prepublish script to prepack, so make -j4 dist only runs before npm pack/npm publish and NOT for npm install. This might require a change in the README. If you disagree with this change, I suggest changing it to prepare instead as per https://docs.npmjs.com/cli/v9/using-npm/scripts#prepare-and-prepublish.
NPM automatically updated package-lock.json after npm install.
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.