egoist / esbuild-register

Transpile JSX, TypeScript and esnext features on the fly with esbuild
MIT License
989 stars 52 forks source link

ReferenceError: Cannot access 'FOO' before initialization #78

Open romanown opened 2 years ago

romanown commented 2 years ago

i have issue ReferenceError: Cannot access 'FOO' before initialization i use modules with redux. when i use babel all works right require('./node-jsx-babel').install();.

when i use esbuild-register as const { register } = require('../node_modules/esbuild-register/dist/node'); register({ hookIgnoreNodeModules: false, hookMatcher(fileName) { return fileName.includes('jsx') || fileName.includes('js') || fileName.includes('ts') || fileName.includes('tsx') || fileName.includes('index') }, }); i have this issue ReferenceError: Cannot access 'FOO' before initialization. when i use string 'FOO' it work.

my code

const FOO= 'mini/FOO';

export default function ( state = { expanded: false, }, action ) { switch (action.type) { case FOO: return { ...state, expanded: true, }; default: return state; } }