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.

Module build failed: SyntaxError: Unexpected token (1:1)

See original GitHub issue

If I specify plugin config in .babelrc it throws the error.

ERROR in ./src/pages/Application.js
Module build failed: SyntaxError: c:/dev/.../Application.js: Unexpected token (1:1)

> 1 | import React, { Component } from 'react'
    |  ^
{
  "presets": ...,
  "plugins": [
    ...,
    ["inline-react-svg", {
      "svgo": false
    }]
  ]
}

If I then use just "inline-react-svg" in .babelrc then it doesn’t throw the error. But in the default mode it discards half of <svg/> attributes like stroke-width="2.5".

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:17

github_iconTop GitHub Comments

4reactions
Szarkocommented, Jan 11, 2019

@ljharb - I can confirm I experience a similar issue. "babel-plugin-inline-react-svg": "~0.5.4",

And a very simple .babelrc:

"pugins": [
    [
      "inline-react-svg",
      { "svgo": false }
    ]  
  ],

When setting svgo:false my application produces: SyntaxError: Unexpected token (1:1) in the console as well.

1reaction
tsiq-swyxcommented, Jul 2, 2018

hmm. honestly i dont know that that is my issue. i’m going to just retract my comment, please ignore it. thanks for the response.

On Mon, Jul 2, 2018 at 3:09 AM Jordan Harband notifications@github.com wrote:

@tsiq-swyx https://github.com/tsiq-swyx it doesn’t look like you’re transpiling modules. This plugin puts in import statements, and node doesn’t support that unflagged, so you’ll need to transpile modules to require.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/airbnb/babel-plugin-inline-react-svg/issues/38#issuecomment-401692155, or mute the thread https://github.com/notifications/unsubscribe-auth/AiT1ghpWFP3OOA8LhlPc4anXimRV3vZKks5uCccngaJpZM4Su9WH .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module build failed: SyntaxError: Unexpected token
I a encountering an weired error and this leaves me perplexed! To my understanding nothing wrong in the syntax in index.jsx which is...
Read more >
Module build failed: SyntaxError: Unexpected token m #13
This issue occurs when applying the json-loader twice. i. e. by using configuration + require("json! . That's wrong. #11 is only a workaround,...
Read more >
Get Started - Hashnode
And I'm getting error: Here is my webpack.config.js file, ... ERROR in ./index.js Module build failed: SyntaxError: Unexpected token.
Read more >
Why am I getting Module build failed: SyntaxError - Vue Forum
Why am I getting Module build failed: SyntaxError: Unexpected token, expected? ... I am doing it in computed and getting this error because...
Read more >
Module build failed: SyntaxError: Unexpected token, expected
Uncaught Error: Module build failed: SyntaxError: Unexpected token, expected ; (4:4). I am getting this error in console and i cannot compile using...
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