fix: add support for building on Windows (#2029)

Fixes #1919

* update path to sapper cli

* use os-aware module rule tests
This commit is contained in:
Dylan Staley 2021-04-11 07:43:53 -07:00 committed by GitHub
parent 7a28bd2d88
commit 11fca7b792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View File

@ -7,11 +7,11 @@
"lint-fix": "standard --fix && standard --fix --plugin html 'src/routes/**/*.html'", "lint-fix": "standard --fix && standard --fix --plugin html 'src/routes/**/*.html'",
"dev": "run-s build-template-html build-assets serve-dev", "dev": "run-s build-template-html build-assets serve-dev",
"serve-dev": "run-p --race build-template-html-watch sapper-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", "before-build": "run-s build-template-html build-assets",
"build": "cross-env NODE_ENV=production run-s build-steps", "build": "cross-env NODE_ENV=production run-s build-steps",
"build-steps": "run-s before-build sapper-export build-vercel-json", "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", "start": "node server.js",
"build-and-start": "run-s build start", "build-and-start": "run-s build start",
"build-template-html": "node -r esm ./bin/build-template-html.js", "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-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", "wait-for-mastodon-data": "node -r esm bin/wait-for-mastodon-data.js",
"backup-mastodon-data": "./bin/backup-mastodon-data.sh", "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", "print-export-info": "node ./bin/print-export-info.js",
"export-steps": "run-s before-build sapper-export print-export-info", "export-steps": "run-s before-build sapper-export print-export-info",
"export": "cross-env NODE_ENV=production run-s export-steps", "export": "cross-env NODE_ENV=production run-s export-steps",

View File

@ -37,7 +37,9 @@ module.exports = {
module: { module: {
rules: [ rules: [
{ {
test: /\/_workers\/blurhash\.js$/, test: input => {
return input.endsWith(path.join("_workers", "blurhash.js"));
},
use: { use: {
loader: 'worker-loader', loader: 'worker-loader',
options: { options: {
@ -46,12 +48,14 @@ module.exports = {
} }
}, },
{ {
test: [ test: input => {
/tesseract\.js\/dist\/worker\.min\.js$/, return (
/tesseract\.js\/dist\/worker\.min\.js.map$/, input.endsWith(path.join("tesseract.js", "dist", "worker.min.js")) ||
/tesseract\.js-core\/tesseract-core\.wasm$/, input.endsWith(path.join("tesseract.js", "dist", "worker.min.js.map")) ||
/tesseract\.js-core\/tesseract-core\.wasm.js$/ input.endsWith(path.join("tesseract.js-core", "tesseract-core.wasm")) ||
], input.endsWith(path.join("tesseract.js-core", "tesseract-core.wasm.js"))
);
},
use: { use: {
loader: 'file-loader', loader: 'file-loader',
options: { options: {