Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

superCtor.prototype is not an object or null #48

Open
ralyodio opened this issue May 23, 2022 · 2 comments
Open

superCtor.prototype is not an object or null #48

ralyodio opened this issue May 23, 2022 · 2 comments

Comments

@ralyodio
Copy link

ralyodio commented May 23, 2022

I am getting this error in browser superCtor.prototype is not an object or null when using jsonwebtoken with sveltekit.

I have polyfills invoked in config but it appears to not solve the issue.

import adapter from '@sveltejs/adapter-static';
import preprocess from 'svelte-preprocess';
import path from 'path';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import dotenv from 'dotenv-flow';
import rollupNodePolyFill from 'rollup-plugin-node-polyfills';

dotenv.config();
const config = {
	preprocess: preprocess(),
	kit: {
		adapter: adapter({
			// default options are shown
			pages: 'build',
			assets: 'build',
			fallback: 'index.html',
			precompress: false
		}),
		vite: {
			optimizeDeps: {
				esbuildOptions: {
					// Node.js global to browser globalThis
					define: {
						global: 'globalThis'
					},
					// Enable esbuild polyfill plugins
					plugins: [
						NodeGlobalsPolyfillPlugin({
							buffer: true,
							global: true,
							process: true,
							url: true,
							assert: true,
							crypto: true,
							http: true,
							https: true,
							os: true,
							stream: true
						})
					]
				}
			},
			resolve: {
				alias: {
					$components: path.resolve('./src/components'),
					$stores: path.resolve('./src/stores'),
					$api: path.resolve('./src/api'),
					$node: path.resolve('./node_modules'),
					'@toruslabs/openlogin': path.resolve(
						'./node_modules/@toruslabs/openlogin/dist/openlogin.umd.min.js'
					)
				}
			},
			build: {
				minify: false,
				rollupOptions: {
					plugins: [
						// Enable rollup polyfills plugin
						// used during production bundling
						rollupNodePolyFill()
					]
				}
			}
		}
	}
};

export default config;

@colearendt
Copy link

This same problem is hitting pouchdb with vite as well pouchdb/pouchdb#8535

Any ideas how to make progress on this?

@replete
Copy link

replete commented Sep 22, 2024

Getting this issue also with Vite and pouchDB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants