-
Notifications
You must be signed in to change notification settings - Fork 959
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
Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. #996
Comments
Feels like a duplicate of #991. You're trying to use You'll have to add something like this in module: {
rules: [
// This would match almost any react-native module
{
test: /(@?react-(navigation|native)).*\.(ts|js)x?$/,
include: /node_modules/,
exclude: [/react-native-web/, /\.(native|ios|android)\.(ts|js)x?$/],
loader: 'babel-loader'
},
// This would match ui-kitten
{
test: /@?(ui-kitten|eva-design).*\.(ts|js)x?$/,
loader: 'babel-loader'
}
]
} |
This code snippet is for For now, I've used installed
I know this code snippet is not clean. Any suggestions regarding this approach are much appreciated. Thanks! :) |
@harryy2510 @lesmo Thanks for sharing workarounds 👍 UPD There is a stackoverflow answer on this issue.
|
@artyorsh I saw you've upgraded to ts3.8 in |
Use the workaround by @harryy2510 as a temporary solution. |
@harryy2510 thanks your suggestion work for me |
Steps
|
Since this is a workaround and we can do nothing about that (excluding possible changes in the build process, which is not an issue), I think I will do nothing on this issue for the package distributed with Despite this, I will make a separate tag to distribute the package builded with outdated build system just to make it compatible with webpack / acorn. The new package will be published together with v5 stable (you may track it here) and installable with @harryy2510 thanks for posting the workarounds and keeping it alive 👍 |
@harryy2510 Thanks, this solution works well. For anyone encountering this issue, I'm just gonna lay out the entire process in steps:
|
@harryy2510 I added that snipped to my webpack.config.js but the problem persists, any other work around? |
@jasuno Can you share the screenshot of exactly what error you are getting? It maybe due to some other module and You might need to add that module too in your webpack config for babel to transform it |
the error says
my config code is set up like this in:
|
@jasuno
|
Thank you very much that actually helped out, I was changing the one in my node modules... yeah I know a silly mistake |
This also causes issues for Jest and React Test Renderer when testing components which import anything from
How on earth is TypeScript specific syntax even making it to the distribution build in the first place? That's surely not the desired output, right? |
@adammcarth Firstly, It is not a typescript specific syntax now. It has been introduced to Javascript also and you'll start to find more of this syntax in near future in almost every project. You can read more about it here - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining Secondly, What you can do is use babel transform in your jest config and use this plugin |
Thanks for the info @harryy2510. I genuinely had no idea the My follow up questions are still going to be quite similar though. Why isn't UI Kitten transpiling down to ES5 JavaScript? What are the benefits of remaining at ES Next and requiring projects to use additional Babel plugins when (I assume) it could just be transpiled to ES5 for increased support and flexibility? The reason I'm asking these questions is because I'm happy to help make those changes if it was just an initial oversight. They weren't meant to come off as accusations; apologies to everyone if they did 👍 |
@adammcarth |
i have some error. I'm not working with expo. Any fix? Ps. "@ui-kitten/components": "^5.0.0" |
@artyorsh i fix, thank you for support! Ps. I'm working with next js and rnw and kitten ui |
Is anyone else running into this issue when using Typescript and Expo? |
After following @harryy2510 I now get:
|
Adding the following underneath the "web" key in app.json also resolves the issue: |
It would be great if someone know how to configure webpack on an app without Expo. |
Hi @harryy2510 I've followed your steps, but I'm getting an error:
|
Here's how to configure webpack with expo. first, run create a paste this:
now you should be able to setup your |
@pabariyash Why are you posting this here when you are using angular? This is an issue with a specific library for React Native and has nothing to do with your setup and framework. |
In order to solve the bug that you bump into as soon as you add `ui-kitten` library to an expo project and try to see the the project in Expo for Web, this super clean solution needs to be part of the docs, thus this PR. akveo#996 (comment)
Thanks @harryy2510 ! Yoursuggestions works great. |
@darcstar-solutions Can you please specify where exactly to add it? ty |
If I add that I get the following error:
Any idea? |
change react-scripts version in package.json to "react-scripts": "^4.0.3" . create-react-app is not pulling the correct version that's why you are facing this issue. |
I am getting this error in my console. |
Are you trying to use |
Did you try this? |
the same error has occurred for me right now !! could you please resolve my bugs so that it would be helpful for me |
Can Anyone say why this error is occurring in the code and I fixed it by adding webpack-config.js after that also the code is showing an error... |
I have stuck with the module parse failed error while adding Toast-Notification in my react-app. |
Hi, I have the same error but with NUXT. I put @expo/webpack-config and created webpack.config. But not work yet. |
hey while importing query-string in react it showing an error:
| query: parse(extract(url), options), |
Thanks @harryy2510 it works. For anyone to whom his solution is not working. Dont forget to replace the package name inside
|
I am getting this error Please Help me to Fix This on Windows 10 Node version. v18.16.1 Failed to compile.
| if (!R) return false; |
do you solve this issue? |
🐛 Bug Report
Not able to build code
UI Kitten and Eva version
Environment information
The text was updated successfully, but these errors were encountered: