-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
dynamic import are unrecognized in 3.0.0-next.b0cbf2ca, compile fails #6673
Comments
If you have a chance do you mind trying Node 10.x? We've had some reports of issues on the latest Node 11.x. I just tested using Node 10.15.1 with the following in my const LazyApp = React.lazy(() => import('./App'));
ReactDOM.render(
<React.Suspense fallback={<div />}>
<LazyApp />
</React.Suspense>,
document.getElementById('root')
); |
With regards to |
Ah, thank you. I was wondering why it wasn't working. |
This bug looks like this bug on webpack, which was root-caused to this bug on npm. |
It's unclear if webpack is going to do anything to fix this issue or if it's just going to be fixed in npm. We'll keep an eye on the webpack issue and see if they release a new version before we publish 3.0 final. |
Is anyone able to reproduce this issue with the latest alpha release? |
@iansu I have the same problem with the v3.0.0 (npm v6.9, node v10.15.1)
|
@ianschmitz Envinfo:
Btw, I still get an error with
I get this error everytime I try to use |
There is an npm/npx bug with usernames that contain a space. I'm not sure if that's related to the dynamic import issue. Maybe try copying your code to a different directory, outside of your user's account, that doesn't have any spaces in the name. Even if that's not a good long term solution it might help us troubleshoot this. npx also uses npm's cache which is probably why you're seeing an error with |
@iansu Thanks for the clarification. |
I don't think so: I have no spaces in my folder names (also I'm on MacOS, so it's not platform specific either) |
Hit this issue in I'll get a repo together that reproduces it, and see if this applies to imports with the file extension specified while I'm at it. |
Repo to reproduce issue https://github.com/Silic0nS0ldier/CRA-6673 |
seems something going on package-lock.json. removing it and reinstalling via npm install fixes the problem. also a fresh install of yarn helps. |
@bugzpodder Indeed. Regenerating the lock file corrects my issue reproduction repo as well (the need for eslint to be installed at the top level hinted at this somewhat). Reports that regenerating the lock file isn't working implies that this isn't the cause, however its plausible that the regeneration isn't producing a valid dependency graph (as far as the code is concerned). Might be a bad mapping between dependencies and packages (packages depending on dependencies they don't explicitly declare) resulting in them on occasion not seeing what they expect. |
Having the same issue on windows, node 10 and without paths containing spaces. Is there a workaround for this? |
Would removing yarn.lock/package-lock.json and node_modules work @delaaxe |
I have the same issue on MacOs, node 10, npm 6.4.1 |
@bugzpodder Tried that a few times with npm. Will try again with yarn |
@kuzman Is this with a clean project as well (as in newly created using the CLI tool)? If not, could you put a list of your dependencies up? I'd like to see if I can get that scenario accounted for in my reproduction repo (https://github.com/Silic0nS0ldier/CRA-6673). |
I finally found a solution that works for me, suggested by @andybarsby and @kylehalleman Running
Does updating the |
Switched to yarn and worked as expected |
@joglr I have this problem and none of the previous suggestions worked for me. I tried your recommendation and can confirm it solves the issue for me |
Proposed workaround works for my reproduction repo as well. Looking in |
Doesn't look like anything else is depending on Perhaps related, perhaps not. I've been digging into webpack to try and track down where it all falls apart and I've noticed some errors in generated code. The first in |
Was facing the same issue. Adding |
I had the same issue and fixed it installing jest is using acorn@5 and looks like somehow it creates a problem. Also you can |
Thank you @joglr |
Thank you @nitinkaveriappa |
Thank you @joglr! |
Has anyone tried installing |
remove/add yarn.lock per facebook/create-react-app#6673
@joglr thank you very much, it worked for me |
Seems to resolve an issue related to using `lazy` on newer versions of Node. Related issue can be found [here](facebook/create-react-app#6673 (comment)).
Is this a bug report?
Yes
Did you try recovering your dependencies?
npm version
6.8.0Which terms did you search for in User Guide?
Environment
I used the command, but I got an error instead.
(node:16088) UnhandledPromiseRejectionWarning: Error: The system cannot find the path specified.
(node:16088) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwinginside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
I'm on Windows 10
Steps to Reproduce
(Write your steps here:)
Expected Behavior
(Write what you thought would happen.)
The build would pass, as it does in previous versions.
Actual Behavior
Reproducible Demo
(Paste the link to an example project and exact instructions to reproduce the issue.)
The text was updated successfully, but these errors were encountered: