Closed seniorquico closed 5 years ago
I have the same issue. I have been struggling for 6 hours, but then I installed versions of packages from an example in this repo and that's working. I have another issue, my typescript aliases don't work. I consider to get rid of babel-ts and move to tsc.
@seniorquico
Thanks for the heads up. I've reproduced the problem and am looking into it. Yep, also looking forward to the more stable target. I've been looking forward to this build in particular because it is now based on Babel 7 proper. It includes the parser enhancements for the more recent TypeScript syntax improvements.
I have the same issue. I have been struggling for 6 hours, but then I installed versions of packages from an example in this repo and that's working. I have another issue, my typescript aliases don't work. I consider to get rid of babel-ts and move to tsc.
Hello,
Sorry to hear your trouble. The new build of react-scripts
was released 16 hours ago. This package makes no attempt to automatically bring over the alias setup from tsconfig into the Webpack config.
This article can shed some light on configuring Webpack to mimic your alias setup: https://medium.com/@martin_hotell/type-safe-es2015-module-import-path-aliasing-with-webpack-typescript-and-jest-fe461347e010
This section of your config-overrides.js
contains the Webpack setup (config
variable):
webpack: function(config, env) {
I'm not sure there is a way to do this safely automatically from the perspective of this package. If anyone is aware of another package doing this, I'd be happy to look that over.
@strothj You're so quick! 👍 I guess I assumed changes wouldn't come until the final 2.0.0 dropped. 😉
Just FYI... they released the final beta today (still tagged as next, but released as version 2.0.0)! I'll give the 2.5.0 update a shot with both react-scripts@2.0.0-next.fb6e6f70 and react-scripts@2.0.0. Thanks!
Once the 2.0 official version drops, I can hopefully remove some cruft from having to handle different beta releases. I haven't tried the @2.0.0 yet. Updating to fb6e6f70
revealed some malformed SVGs I had. Once I took care of those everything built fine.
react-app-rewire-typescript-babel-preset@2.5.0 works great in our project with react-scripts@2.0.0. 🎉
Having this issue again with @2.5.0 and react-scripts@2.0.2 and up
I know changes are still happening as the CRA crowd makes their way toward the final 2.0 release. I just thought I'd document via this issue that the rewire doesn't work with the latest react-scripts@2.0.0-next.fb6e6f70. It fails with the following:
I think this is happening because the rewire is looking for a test with the ".mjs" file extension, which the latest react-scripts dropped.
For reference, the latest version I've been able to get to compile and run correctly is react-scripts@2.0.0-next.a671462c.
I'm hoping the CRA team is able to make their 2.0 release soon (already half way through the proposed 2 week timeline). Looking forward to the prospect of this (and other) packages getting a more stable target on which to build. 😄