Webpacker behaves differently in production from development modes

80 Views Asked by At

Deployment of an application is occuring as expected in development mode, but failing in production mode at this stage

$HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile

rake stdout: yarn install v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 4.73s.
Compiling...
Compilation failed:
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
    ["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
to the "plugins" section of your Babel config.
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-property-in-object.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
    ["@babel/plugin-proposal-private-methods", { "loose": true }]
to the "plugins" section of your Babel config.
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-property-in-object since the "loose" mode option was set to "true" for @babel/plugin-proposal-class-properties.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
    ["@babel/plugin-proposal-private-property-in-object", { "loose": true }]
to the "plugins" section of your Babel config.
Though the "loose" option was set to "false" in your @babel/preset-env config, it will not be used for @babel/plugin-proposal-private-methods since the "loose" mode option was set to "true" for @babel/plugin-proposal-private-property-in-object.
The "loose" option must be the same for @babel/plugin-proposal-class-properties, @babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object (when they are enabled): you can silence this warning by explicitly adding
    ["@babel/plugin-proposal-private-methods", { "loose": true }]
to the "plugins" section of your Babel config.
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/deploy/dapp/shared/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/home/deploy/dapp/shared/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/home/deploy/dapp/shared/node_modules/webpack/lib/NormalModule.js:471:10)
    at /home/deploy/dapp/shared/node_modules/webpack/lib/NormalModule.js:503:5
    at /home/deploy/dapp/shared/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/deploy/dapp/shared/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/deploy/dapp/shared/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/home/deploy/dapp/shared/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /home/deploy/dapp/shared/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at context.callback (/home/deploy/dapp/shared/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /home/deploy/dapp/shared/node_modules/babel-loader/lib/index.js:44:71 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.15.0

the fact that the deployment executes fully in development, but not in production is a worrisone factor.

To top things off, one can go to the VPS, find the latest release directory and run both yarn install and RAILS_ENV=production bundle exec rake assets:precompile with no issue whatsoever.

Then... running cap production deploy actually completes as expected. which is not expected.

What is going on here between webpacker and capistrano? I suspect further changes will be subjec to jumping through the same hoops anew & would like to avoid doing so.

0

There are 0 best solutions below