From 7884b5cffcb5d050dda52161b14c7dd09cc5c159 Mon Sep 17 00:00:00 2001 From: Vitaly Date: Mon, 25 Mar 2024 13:47:01 +0300 Subject: [PATCH] three shake three.js (#94) --- scripts/esbuildPlugins.mjs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/esbuildPlugins.mjs b/scripts/esbuildPlugins.mjs index 07938c6ec..95d88b8ed 100644 --- a/scripts/esbuildPlugins.mjs +++ b/scripts/esbuildPlugins.mjs @@ -27,7 +27,8 @@ const plugins = [ build.onLoad({ filter: /minecraft-data[\/\\]data.js$/, }, (args) => { - const version = supportedVersions.at(-1); + const version = supportedVersions.at(-1) + if (!version) throw new Error('unreachable') const data = MCData(version) const defaultVersionsObj = { // default protocol data, needed for auto-version @@ -47,6 +48,14 @@ const plugins = [ }, () => { throw new Error('hit banned package') }) + + build.onResolve({ + filter: /^three$/, + }, async ({ kind, resolveDir }) => { + return { + path: (await build.resolve('three/src/Three.js', { kind, resolveDir })).path, + } + }) } }, {