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

@autoInjectable doesn't work with Create React App #188

Open
jbrighton-dev opened this issue Jan 15, 2022 · 1 comment
Open

@autoInjectable doesn't work with Create React App #188

jbrighton-dev opened this issue Jan 15, 2022 · 1 comment
Assignees

Comments

@jbrighton-dev
Copy link

jbrighton-dev commented Jan 15, 2022

Describe the bug

@autoInjectable doesn't work with Create React App.

To Reproduce

image
image
image

Expected behavior

I'm sure there's an issue surrounding the way webpack is processing these file, but without ejecting the app, is this possible?
We also want to avoid using the container.resolve() syntax. If its possible to get instances of classes from the container in tsx files without either container.resolve() or autoinjectable, then shout.

Version:

"react-scripts": "^5.0.0",
"tsyringe": "^4.6.0",
@radnaxel-a
Copy link

@JoeBrighton If you are using babel within webpack, make sure to have it configured to work with tsyringe .
https://github.com/microsoft/tsyringe#babel

I was facing the same error with @autoInjectable in a blank TS project. Configuring babel fixed the issue for me.

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

No branches or pull requests

3 participants