question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unexpected token, You may need an appropriate loader to handle this file type.

See original GitHub issue

Just created an npm package, and when i use it on my project created by create-react-app got error, any thoughts?

Module parse failed: Unexpected token (8:6)
You may need an appropriate loader to handle this file type.
|   render() {
|     return (
|       <section className="FullWidthLoading-section">
|         <Spin
|           delay={props.delay}

my npm package

class FullWidthLoading extends Component {
  render() {
   return (
    <section className="FullWidthLoading-section">
      <Spin
        delay={props.delay}
        indicator={props.indicator}
        size={props.size}
        spinning={props.spinning}
        tip={props.tip}
        wrapperClassName={props.wrapperClassName}
      >
        {props.children}
      </Spin>
    </section>
    )
  }
};

export default FullWidthLoading;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
gaearoncommented, Jan 7, 2018

You need to compile code before publishing. People who use your library shouldn’t need to configure anything to use it.

Here’s a tool that you can use to do that: https://github.com/insin/nwb

4reactions
threepointonecommented, Jan 4, 2018

you should ship compiled code in your npm package, not raw jsx, since babel/other loaders don’t run on anything inside node_modules.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"You may need an appropriate loader to handle this file type ...
Step-2: In order to compile JSX code to es5 babel provides @babel/preset-react package to convert react jsx extension file to native browser ...
Read more >
Module parse failed: Unexpected token. You may ... - GitHub
Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type, currently no loaders are configured to process...
Read more >
You may need an appropriate loader to handle this file type ...
I 'm having a problem configuring Webpack for Typescript and React. After running the NPM script: webpack serves ./webpack/webpack.config.ts ...
Read more >
Odyssey Lift-off I: "Module parse failed: Unexpected token" Error
You may need an appropriate loader to handle this file type. Looks like webpack is unhappy for some reason. Could be a few...
Read more >
You might need an appropriate loader to handle the file type ...
You might need an appropriate loader to handle the file type error. r/react - Hi , I am getting an ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found