I'm having issues with integrating the eth-crypto module into my Quasar app that utilizes Vite.
The errors I'm encountering are related to the absence of the Buffer object, which is expected since it's typically found in the front end.
Is there a recommended approach for importing a polyfill to address this issue?
Thus far, I've attempted the following modifications in my quasar.config.js file:
const { configure } = require('quasar/wrappers');
const path = require('path');
const buffer = require('buffer');
module.exports = configure(function (ctx) {
return {
...
build: {
target: {
browser: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
node: 'node16'
},
vueRouterMode: 'hash', // available values: 'hash', 'history'
env: {
VUE_APP_API: ctx.dev
? 'http://localhost:3000'
: 'https://prod.api.com'
},
rawDefine: {
global: {},
buffer: buffer,
Buffer: buffer.Buffer
},
vitePlugins: [
['@intlify/vite-plugin-vue-i18n', {
include: path.resolve(__dirname, './src/i18n/**')
}],
[
'vite-plugin-bundle',
{
entries: [
]
}
]
],
}
}
Despite these adjustments, I'm unable to successfully import the Buffer object in order to make it accessible to npm modules.