Commit graph

23 commits

Author SHA1 Message Date
Georgi Angelov
36d7d274f8 chore: use the preferred webpack config format 2024-10-23 15:45:27 +03:00
Georgi Angelov
78b2c66140 fix: fix web worker usage in scratch-vm integration tests 2024-10-23 15:04:57 +03:00
Georgi Angelov
ff5b428e71 chore!: can't have a default and non-default exports in commonjs
BREAKING CHANGE: The ScratchStorage constructor is now exported
as a named export instead of a default export.
2024-10-11 18:09:30 +03:00
Georgi Angelov
3d0b429526 feat!: upgrade webpack to 5 and add TS support
Breaking flag is because it may have some differences in the way the library is exported -
`module.exports = ` vs `module.exports.default = `. That would depend on the Webpack config,
so it should continue working, but just to be safe.
2024-10-10 11:45:50 +03:00
Christopher Willis-Ford
570d47868b refactor: don't use !arraybuffer-loader! notation 2023-05-01 14:18:56 -07:00
Christopher Willis-Ford
3283740a04 chore: insert scratchFetch into FetchTool's pipeline 2023-03-09 13:39:24 -08:00
Christopher Willis-Ford
fd6f3a166a refactor: use cross-fetch instead of node-fetch
Previously, we had Webpack's ProvidePlugin injecting `node-fetch` as a
polyfill into Node builds, and web builds just relied on the `fetch`
built into the browser (if it's there).

Now, we use `cross-fetch` everywhere, and as a ponyfill instead of a
polyfill. This broke the unit tests in `fetch-tool.js` because they were
overriding `global.fetch` to mock `node-fetch`. Now, those tests use
`tap.mock` to mock `cross-fetch`. Of course, `tap.mock` didn't exist in
the old version of `node-tap`, so I also upgraded that.
2023-03-09 13:39:24 -08:00
Christopher Willis-Ford
ebcbcdbae1 fix: polyfill 'fetch' for Node target 2022-05-09 08:53:20 -07:00
adroitwhiz
7f62d2303a refactor: remove NetsTool 2019-11-11 18:20:24 -05:00
Ray Schamp
5bca2e6a83 chore(package): upgrade babel and its friends
Upgrade babel to accommodate babel-loader upgrade. After upgrading babel, upgrade polyfill and preset-env to accommodate the babel upgrade.
2018-10-24 10:43:46 +01:00
Michael "Z" Goddard
b7e7d6d9b9
chore(package): expose src/index as browser entry point
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.
2018-05-09 10:07:02 -04:00
Ray Schamp
2af9ec2542
Merge pull request from mzgoddard/babel-preset-env
chore(build): replace babel-preset-es2015 with babel-preset-env
2018-05-08 16:51:01 -04:00
Michael "Z" Goddard
6ecbde5a2c
chore(build): replace babel-preset-es2015 with babel-preset-env 2018-05-07 13:35:38 -04:00
Michael "Z" Goddard
a0ab19326b
chore(build): update to webpack 4 2018-05-07 13:33:18 -04:00
Christopher Willis-Ford
c1f66ce132 Don't use separate web entry point: let UMD do it
Using UMD for the web build conflicts with the old `index-web.js` file,
since they both try to do roughly the same thing. This change should
have been part of the recent switch to UMD output for `dist/web`.
2017-09-26 00:39:03 -04:00
Christopher Willis-Ford
07841c0496 Use UMD for browser output; add "browser" field
Using UMD makes the build output more flexible and adds a very small
amount of overhead.
The "browser" field is one of the key features we've been missing and
should solve many of our build frustrations. See here for details on the
"browser" field in `project.json`:
https://github.com/defunctzombie/package-browser-field-spec
2017-09-13 11:31:33 -07:00
Geng Shenghong
6fc4832f97 replace 'got' with 'nets' and fix the 'web+commonjs2' and 'node+commonjs2' targets in webpack.config.js 2017-09-08 15:08:26 +08:00
Christopher Willis-Ford
6d9b746597 Standardize repository settings
Set dev tool to `cheap-module-source-map`.
2017-04-11 11:38:42 -04:00
Christopher Willis-Ford
0bb5f2f30f Upgrade to Webpack 2 2017-02-03 12:40:44 -08:00
Christopher Willis-Ford
2b28f27049 Add tests, fix problems found by those tests
Changes include:
- Use `bin-loader` instead of `arraybuffer-loader` since the latter is
  only compatible with browsers, not with Node itself.
- Use `got` instead of `xhr` since `xhr` only works in browsers and
  `got` is nicer anyway.
- Add `json-loader` to Webpack config since `got` requires it.
- Use lower-case values in `DataFormat` to match canonical file names.
- Update `ScratchStorage.addWebSource` to match `WebHelper`'s new API.
- Fix an error in the web helper which was causing an infinite loop on
  error.
2016-12-08 16:45:56 -08:00
Christopher Willis-Ford
5401c5e17f Configuration updates
Update eslint-config-scratch to 3.1.0
Explicitly specify target for Webpack outputs
2016-12-06 16:23:11 -08:00
Christopher Willis-Ford
e6ba286530 First-pass implementation of the load API
This implementation is untested and not complete, but should be
sufficient for discussion.
2016-11-08 16:08:55 -08:00
Christopher Willis-Ford
8184fb9b14 Initial structure 2016-10-21 18:27:47 -07:00