Skip to content

Commit 9b5b0fc

Browse files
committed
Add source-map wasm to worker package
1 parent 5e0aaeb commit 9b5b0fc

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
22
worker/worker.js
3+
worker/mappings.wasm
34
fixtures/app/static
45
yarn-error.log

worker/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
"version": "1.0.1",
44
"main": "worker.js",
55
"files": [
6-
"worker.js"
6+
"worker.js",
7+
"mappings.wasm"
78
],
89
"scripts": {
9-
"prepare": "webpack-cli"
10+
"prepare": "webpack-cli && node scripts/copy-wasm.js"
1011
},
1112
"devDependencies": {
1213
"css-to-js-sourcemap-core": "*",
14+
"resolve-from": "^4.0.0",
1315
"webpack": "^4.10.2",
1416
"webpack-cli": "^2.1.4"
1517
},

worker/scripts/copy-wasm.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-env node */
2+
3+
const path = require("path");
4+
const fs = require("fs");
5+
const resolveFrom = require("resolve-from");
6+
7+
const corePath = path.dirname(require.resolve("css-to-js-sourcemap-core"));
8+
9+
const wasmPath = path.join(
10+
path.dirname(resolveFrom(corePath, "source-map")),
11+
"lib/mappings.wasm",
12+
);
13+
14+
fs.createReadStream(wasmPath).pipe(
15+
fs.createWriteStream(path.resolve(__dirname, "../mappings.wasm")),
16+
);

yarn.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4207,6 +4207,10 @@ resolve-from@^3.0.0:
42074207
version "3.0.0"
42084208
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748"
42094209

4210+
resolve-from@^4.0.0:
4211+
version "4.0.0"
4212+
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
4213+
42104214
resolve-url@^0.2.1:
42114215
version "0.2.1"
42124216
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"

0 commit comments

Comments
 (0)