Closed bryanmylee closed 1 year ago
Here's a modification of the above minimum reproduction repo, but it uses rollup
https://github.com/rohanrajpal/svelte-headless-table-rollup
instanceof
works as expected in this repo, so the issue is probably with Vite.
Since Vite uses Rollup, I was just canceling the possibility of an error there. Tho, I have little knowledge of how Vite works, so not sure if this experiment was actually of any help.
I can confirm that this bug exists. In my case it appeared in JSBI lib. There's instanceof
check in JSBI object methods that fails, because object has o3
class instead JSBI
.
I have found this bug when connected @uniswap/widgets to react 18 app bootstrapped with Vite
We also have the problem that instanceof
does not work. Probably the classes in dev mode exist several times.
Comment in issue: https://github.com/fabian-hiller/modular-forms/issues/59#issuecomment-1544476176 PR with workaround: https://github.com/fabian-hiller/modular-forms/pull/66
Any news on this issue?
Any updates on the potential fixes?
Tried with:
import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
esbuild: {
minifyIdentifiers: false,
keepNames: true,
},
})
same results
Duplicate of #3910
Describe the bug
I am building a table library for Svelte which uses classes and
instanceof
checks quite extensively. I've noticed that the behaviour ofinstanceof
is different betweenyarn dev
andyarn build && yarn preview
. More specifically,instanceof
returns false in cases where I expect it to return true.My core library (
svelte-headless-table
) exposes an argument that accepts an object of plugins. These plugins are exported fromsvelte-headless-table/plugins
that can extend the library's functionality. Some plugins useinstanceof
checks for their logic, butinstanceof
results in incorrect behaviour.The issue persists with
npm
andpnpm
.Catching the issue
The issue does not surface if I use
npm link
orpnpm.overrides
to debug the package. I've only been able to catch the issue by addingconsole.log
statements to the packaged library files innode_modules/
. I've added instructions to the reproduction repo on how to do so.Dev mode
Preview mode
Relevant discussion
An existing issue thread exists here.
Reproduction
https://github.com/bryanmylee/svelte-headless-table-vite-instanceof-check
System Info
Used Package Manager
yarn
Logs
No errors are thrown and the library fails silently in
dev
.Validations