8

I have a large angular SSR application that uses argon2 on the backend for hashing passwords. I am currently trying to bundle the application using Webpack and having problems with argon2's dependency on @mapbox/node-pre-gyp preventing the Webpack build from succeeding.

The error I'm receiving is:

./node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.6/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html:1:0 - Error: Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>

I've tried adding a rule for Webpack's IgnorePlugin as follows:

new IgnorePlugin({
  resourceRegExp: /\.html$/,
  contextRegExp: /@mapbox\/node-pre-gyp/
})

But the file isn't being ignored by Webpack.

I've also tried adding html-loader to the Webpack config for HTML files, but it doesn't seem to be picking up the HTML file either.

Is there something that I'm doing wrong with trying to ignore the HTML file coming from node-pre-gyp

Joseph Quinn
  • 101
  • 5

0 Answers0