diff --git a/api/src/main.spec.ts b/api/src/main.spec.ts new file mode 100644 index 0000000..bbdf0e1 --- /dev/null +++ b/api/src/main.spec.ts @@ -0,0 +1,5 @@ +describe('api', () => { + it('should work', () => { + expect(true).toBe(true) + }) +}) diff --git a/web/src/main.tsx b/web/src/main.tsx index 3f3dbf4..f6eb3c3 100644 --- a/web/src/main.tsx +++ b/web/src/main.tsx @@ -1,6 +1,7 @@ import { StrictMode } from 'react' import * as ReactDOM from 'react-dom/client' import { BrowserRouter } from 'react-router-dom' +import './polyfill' import { App } from './app/app' diff --git a/web/src/polyfill.ts b/web/src/polyfill.ts new file mode 100644 index 0000000..7a84fb3 --- /dev/null +++ b/web/src/polyfill.ts @@ -0,0 +1,6 @@ +// Polyfill the browser, prevents the error "Uncaught ReferenceError: Buffer is not defined" +if (typeof window !== 'undefined' && typeof window.global === 'undefined' && typeof Buffer === 'undefined') { + window['global'] = window + // eslint-disable-next-line @typescript-eslint/no-var-requires + global.Buffer = require('buffer').Buffer +} diff --git a/web/webpack.config.js b/web/webpack.config.js index 3795b47..311da96 100644 --- a/web/webpack.config.js +++ b/web/webpack.config.js @@ -7,6 +7,7 @@ module.exports = composePlugins(withNx(), withReact(), (config) => { // e.g. `config.plugins.push(new MyPlugin())` config.ignoreWarnings = [/Failed to parse source map/] config.resolve.fallback = { + buffer: require.resolve('buffer/'), crypto: false, } return config