Downstream webpack will need any dependencies src/ depends on so it can
successfully build. Also if multiple packages being built into a larger
script share a common dependency version range, they can share the
dependency instead of duplicating it. This will save built file size,
execution time, and memory.
The playground was trying to build with a now-missing entry point.
Also, I fixed some JSDoc comments, added HTML labels, etc. until IDEA
had no meaningful complaints about `playground/index.html`.
On Windows and Cygwin the path to JS source files may contain
backslashes, forward slashes, or a mix. The regex used to test whether
or not to use `ify-loader` contains path separators; this change allows
either slash instead of requiring only forward slashes.
Add missing file type to `.gitattributes`.
Use `node` instead of deprecated `stable` version specifier for Travis.
Set dev tool to `cheap-module-source-map`.
The playground now must be loaded with a URL that ends in "/playground/"
or "/playground/index.html"; loading at "/" will no longer work.
The /playground folder is now purely an output of the build process,
rather than being a mix of build output and static content. The static
content that was previously there (namely, index.html) has been moved
into /src/playground. The `contentBase` has been set to `false` to avoid
confusion between current, in-memory build output and stale, on-disk
build output.
This change tweaks the expression of paths in the Webpack config to make
`webpack-dev-server` work again. This opened the door for some minor
cleanup of `path` & `filename` in the `output` configuration entries.
Thanks to @rschamp for help resolving the `webpack-dev-server` problems.
- Move build outputs into `dist/`
- Make build output file names more consistent
- Update `playground/index.html` for new output file name
- Explicitly specify target => Node output is much smaller
- Minor fixes / cleanup in `.gitignore` and `src/index*.js`
When running on Windows, Webpack seems to more reliably notice altered
files when running in polling mode. We already use the `--watch-poll`
argument in the `watch` script, but this change adds equivalent settings
to the config used in the `start` script by `webpack-dev-server`.
If another package wants to import `src/index.js`, it needs to replicate the loader config in `webpack.config.js`. To avoid this, package the module in `dist.js` and set that as the module to require.
I changed `main` to point to this so that other packages can just `require('scratch-blocks')`, but it would also work for our purposes to add `"webpack": "./dist.js"` if we want to keep `src/index.js` as `main`.
The build generates a new output set called `render-webgl-worker`, meant
to be imported from a web worker. This exposes the `RenderWebGLRemote`
class to facilitate communication with the renderer using `postMessage`
and `onmessage`.
Only a few messages are implemented so far, but it's enough to run the
demo page.