You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a module that doesn't play well with esbuild, (eg: html-minifier), deploying to Vercel is technically successful but results in failing page visits.
In my case, I've used the html-minifier package to write a simple handle hook that minifies html.
The deploys were previously showing warnings that certain relative paths needed to be marked as external for esbuild.
All of these warnings had ties to uglify-js, a dependency of html-minifier.
These warnings disappeared when html-minifier was marked as external
Here are the steps I took to create the reproduction:
Start with default skeleton with all extras enabled.
Install html-minifier and create a simple handle hook that minifies html.
At this point, I would expect the following warnings on Vercel:
Warnings on Vercel deployment log
▲ [WARNING] "../lib/utils.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:4:20:
4 │ require.resolve("../lib/utils.js"),
╵ ~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/ast.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:5:20:
5 │ require.resolve("../lib/ast.js"),
╵ ~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/transform.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:6:20:
6 │ require.resolve("../lib/transform.js"),
╵ ~~~~~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/parse.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:7:20:
7 │ require.resolve("../lib/parse.js"),
╵ ~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/scope.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:8:20:
8 │ require.resolve("../lib/scope.js"),
╵ ~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/compress.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:9:20:
9 │ require.resolve("../lib/compress.js"),
╵ ~~~~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/output.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:10:20:
10 │ require.resolve("../lib/output.js"),
╵ ~~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/sourcemap.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:11:20:
11 │ require.resolve("../lib/sourcemap.js"),
╵ ~~~~~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/mozilla-ast.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:12:20:
12 │ require.resolve("../lib/mozilla-ast.js"),
╵ ~~~~~~~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/propmangle.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:13:20:
13 │ require.resolve("../lib/propmangle.js"),
╵ ~~~~~~~~~~~~~~~~~~~~~~
▲ [WARNING] "../lib/minify.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:14:20:
14 │ require.resolve("../lib/minify.js"),
╵ ~~~~~~~~~~~~~~~~~~
▲ [WARNING] "./exports.js" should be marked as external for use with "require.resolve"
node_modules/.pnpm/[email protected]/node_modules/uglify-js/tools/node.js:15:20:
15 │ require.resolve("./exports.js"),
╵ ~~~~~~~~~~~~~~
Install the adapter-vercel and specify html-minifier as an external module.
Logs
Here's an example log for functions that are invoked when a user visits the deployed site:ERROR Cannot find module 'html-minifier' Did you forget to add it to "dependencies" in `package.json`? Runtime exited with error: exit status 1
Describe the bug
When using a module that doesn't play well with
esbuild
, (eg:html-minifier
), deploying to Vercel is technically successful but results in failing page visits.In my case, I've used the
html-minifier
package to write a simplehandle
hook that minifieshtml
.Reproduction
Here is a link to a reproduction.
Here are the steps I took to create the reproduction:
html-minifier
and create a simplehandle
hook that minifieshtml
.At this point, I would expect the following warnings on Vercel:
Warnings on Vercel deployment log
adapter-vercel
and specifyhtml-minifier
as anexternal
module.Logs
System Info
Severity
blocking an upgrade
Additional Information
pnpm
as my package managerI think I might be missing some configuration.
Any help is appreciated!
Thank you for your time!
The text was updated successfully, but these errors were encountered: