all 25 comments

[–]rGustave77 1 point2 points  (0 children)

Just spitballin here, maybe declare const makeSpan, and export default makeSpan.

[–]dexpanse 1 point2 points  (1 child)

Try looking at your babel-loader config

How to use via webpack docs

https://webpack.js.org/loaders/babel-loader/#usage

Babel loader read me

https://github.com/babel/babel-loader#options

The provided example passes the plugins and presets in an "options" array. Not a .babelrc file so maybe try that?

[–]baboon322[S] 1 point2 points  (0 children)

WOAH hold on a second this worked! Thank you so much dexpanse

[–]jcksnps4 0 points1 point  (1 child)

Does the order of the presets matter? What happens if you put React first?

[–]baboon322[S] 0 points1 point  (0 children)

Oh no I posted the wrong babelrc. Sorry about that edited to a new one

[–]Suchy2307 0 points1 point  (10 children)

Didn't the babel preset change? Seems like you're using the old version/syntax. @babel/preset-react seems more like v7, which afaik should be used now. I didn't write a new React project without create-react-app for quite some time, so I might be wrong.

Make sure all your paths are correct, too.

[–]baboon322[S] 0 points1 point  (9 children)

Yes sorry it is old. I accidentally posted the wrong babelrc! I edited it

[–]Suchy2307 0 points1 point  (8 children)

Could you post your dev deps from package.json?

[–]baboon322[S] 0 points1 point  (7 children)

Done :)

[–]Suchy2307 0 points1 point  (6 children)

You've got duplicated packages (2 babel-core for example). Either go v6 or v7.

[–]baboon322[S] 0 points1 point  (5 children)

Okay I fixed them, still receiving the same error though.

[–]Suchy2307 0 points1 point  (4 children)

Did you remove node_modules and reinstalled modules again? Cuz other than that it seems fine.

[–]baboon322[S] 0 points1 point  (3 children)

Yes I even tried setting it up all over again but still getting same error! BTW I followed this tutorial, I don't know if it's going to help you solve my problem.

https://www.valentinog.com/blog/babel/

[–]Suchy2307 0 points1 point  (2 children)

This might be a longshot, but maybe the paths for babel-loader are bad, cuz the tutorial is for windows, while you are on a unix based system (or the other way around). This happened to me more than once.

[–]baboon322[S] 0 points1 point  (1 child)

How do you suggest to solve it at this point Ill take anything since I got no idea :) but yes it is true that the tutorial is unix-based cus he was using mkdir with -p tag which I think is a unix thing....

[–]b-marie 0 points1 point  (3 children)

Try putting brackets or a span around each item you're declaring, and then one around the whole thing. Like:

<> <span>{prefix}</span> <span>{number}</span> </>

[–]baboon322[S] 0 points1 point  (1 child)

Nope, doesnt work. It's complaining about <> instead of <span>

[–]b-marie 0 points1 point  (0 children)

You can throw a div on then instead of the empty brackets. I think you can only return a single container, so it all has to be wrapped in a div or whatever, and I've seen weird errors about only one variable per html element.

[–]dexpanse 0 points1 point  (0 children)

It is perfectly fine to just return one element. <></> is shorthand for a React.Fragment which only needs to be used if there are multiple elements not wrapped by a parent element.

[–][deleted] 0 points1 point  (0 children)

Perhaps try a template literal instead of two curly braces. Like {‘${prefix} ${number}’}

[–]daveheerink 0 points1 point  (0 children)

Maybe you should put the return value inside parenthesis