From 11fca7b7928c89c3bac6959f1bd963873db6bd30 Mon Sep 17 00:00:00 2001 From: Dylan Staley <88163+dstaley@users.noreply.github.com> Date: Sun, 11 Apr 2021 07:43:53 -0700 Subject: [PATCH] fix: add support for building on Windows (#2029) Fixes #1919 * update path to sapper cli * use os-aware module rule tests --- package.json | 6 +++--- webpack/client.config.js | 18 +++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 557cd542..088734d1 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,11 @@ "lint-fix": "standard --fix && standard --fix --plugin html 'src/routes/**/*.html'", "dev": "run-s build-template-html build-assets serve-dev", "serve-dev": "run-p --race build-template-html-watch sapper-dev", - "sapper-dev": "cross-env NODE_ENV=development PORT=4002 node -r esm ./node_modules/.bin/sapper dev", + "sapper-dev": "cross-env NODE_ENV=development PORT=4002 node -r esm ./node_modules/sapper/sapper dev", "before-build": "run-s build-template-html build-assets", "build": "cross-env NODE_ENV=production run-s build-steps", "build-steps": "run-s before-build sapper-export build-vercel-json", - "sapper-build": "node -r esm ./node_modules/.bin/sapper build", + "sapper-build": "node -r esm ./node_modules/sapper/sapper build", "start": "node server.js", "build-and-start": "run-s build start", "build-template-html": "node -r esm ./bin/build-template-html.js", @@ -31,7 +31,7 @@ "wait-for-mastodon-to-start": "node -r esm bin/wait-for-mastodon-to-start.js", "wait-for-mastodon-data": "node -r esm bin/wait-for-mastodon-data.js", "backup-mastodon-data": "./bin/backup-mastodon-data.sh", - "sapper-export": "cross-env PORT=22939 node -r esm ./node_modules/.bin/sapper export", + "sapper-export": "cross-env PORT=22939 node -r esm ./node_modules/sapper/sapper export", "print-export-info": "node ./bin/print-export-info.js", "export-steps": "run-s before-build sapper-export print-export-info", "export": "cross-env NODE_ENV=production run-s export-steps", diff --git a/webpack/client.config.js b/webpack/client.config.js index c8325036..3acefc26 100644 --- a/webpack/client.config.js +++ b/webpack/client.config.js @@ -37,7 +37,9 @@ module.exports = { module: { rules: [ { - test: /\/_workers\/blurhash\.js$/, + test: input => { + return input.endsWith(path.join("_workers", "blurhash.js")); + }, use: { loader: 'worker-loader', options: { @@ -46,12 +48,14 @@ module.exports = { } }, { - test: [ - /tesseract\.js\/dist\/worker\.min\.js$/, - /tesseract\.js\/dist\/worker\.min\.js.map$/, - /tesseract\.js-core\/tesseract-core\.wasm$/, - /tesseract\.js-core\/tesseract-core\.wasm.js$/ - ], + test: input => { + return ( + input.endsWith(path.join("tesseract.js", "dist", "worker.min.js")) || + input.endsWith(path.join("tesseract.js", "dist", "worker.min.js.map")) || + input.endsWith(path.join("tesseract.js-core", "tesseract-core.wasm")) || + input.endsWith(path.join("tesseract.js-core", "tesseract-core.wasm.js")) + ); + }, use: { loader: 'file-loader', options: {