Skip to content

Commit

Permalink
build: fix vercel build (DIYgod#13006)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony authored and auto-bot-ty committed Aug 19, 2023
1 parent fef75d4 commit db0e989
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ RUN \
cp /app/scripts/docker/minify-docker.js /minifier/ && \
export PROJECT_ROOT=/app && \
node /minifier/minify-docker.js && \
# Add back anything that are required but removed by by @vercel/nft
cp /app/node_modules/re2-wasm/build/wasm/re2.wasm /app/app-minimal/node_modules/re2-wasm/build/wasm/re2.wasm && \
# Use the minified node_modules
rm -rf /app/node_modules /app/scripts && \
mv /app/app-minimal/node_modules /app/ && \
Expand Down
4 changes: 4 additions & 0 deletions lib/middleware/parameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const { simplecc } = require('simplecc-wasm');
const got = require('@/utils/got');
const config = require('@/config').value;
const { RE2 } = require('re2-wasm');
const { resolve } = require('path');

let mercury_parser;

Expand Down Expand Up @@ -184,6 +185,9 @@ module.exports = async (ctx, next) => {
};

if (ctx.query.filter) {
// workaround for @vercel/nft removing wasm file
resolve('node_modules/re2-wasm/build/wasm/re2.wasm');

ctx.state.data.item = ctx.state.data.item.filter((item) => {
const title = item.title || '';
const description = item.description || title;
Expand Down

0 comments on commit db0e989

Please sign in to comment.