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

TypeScript Loader error when used with Create React App #9

Open
yodiyo opened this issue Sep 18, 2024 · 5 comments
Open

TypeScript Loader error when used with Create React App #9

yodiyo opened this issue Sep 18, 2024 · 5 comments

Comments

@yodiyo
Copy link

yodiyo commented Sep 18, 2024

I'm getting an error when trying to use this with CRA, even with the TS compiler.

Failed to compile.
Module parse failed: The keyword 'interface' is reserved (4:0)
File was processed with these loaders:

  • ./node_modules/source-map-loader/dist/cjs.js
    You may need an additional loader to handle the result of these loaders.

It's similar to an issue explain here - facebook/create-react-app#5623 - the final comment suggests that the package should be compiled before publishing.

Hope that helps.

@ncoughlin
Copy link
Owner

I can look into this, however if you are starting a new project, I recommend that you look into Vite or Next, as CRA is deprecated. They stopped updating it years ago.

@CalamityAdam
Copy link

CalamityAdam commented Oct 1, 2024

I'm seeing the same error in a webpack typescript react app. NOT using cra.

ERROR in ./node_modules/@cascadia-code/scroll-to-hash-element/src/index.tsx 4:0
Module parse failed: The keyword 'interface' is reserved (4:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
|
> interface ScrollToHashElementProps {
|   behavior?: ScrollBehavior;
|   inline?: ScrollLogicalPosition;

I'm guessing the build was not ran before publishing, because looking at the installed package in my node_modules/ shows only a src/index.tsx and no dist/index.js as called out by the package.json: "main": "dist/index.js",

Screenshot 2024-10-01 at 10 43 52 AM

@ncoughlin
Copy link
Owner

I'll check this out.

@ncoughlin
Copy link
Owner

I've updated to version 2.0.3 which now should output a compiled index.js file into the dist folder.
Please let me know if this resolves the issue for you.

@Mauladen
Copy link

Mauladen commented Nov 4, 2024

@ncoughlin At the moment, there is no type in the latest version of the package that breaks the build.

Снимок экрана 2024-11-04 в 13 23 17

I also noticed that you have a commit where you added them, but the latest version does not include this commit

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

No branches or pull requests

4 participants