M
M
Michael La2019-12-21 15:20:48
React
Michael La, 2019-12-21 15:20:48

Error while building React Parcel?

"URI malformed" error occurs (React App(create-react-app + eject)

// src/index.js

import React from 'react';
import ReactDOM from 'react-dom';
import './index.scss';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));

serviceWorker.unregister();

// public/index.html 
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <script src="https://apis.google.com/js/platform.js" async defer></script>
    <link rel="manifest" href="%PUBLIC_URL%/manifest.json">
  </head>
  <body>
    <noscript>
      You need to enable JavaScript to run this app.
    </noscript>
    <div id="root"></div>
    <script src="../src/index.js"></script>
  </body>
</html>

How can I remove this error and collect everything normally in Parcel?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2019-12-21
@miraage

I suspect %PUBLIC_URL% is not supported in Parcel out of the box.
In CRA, this works due to InterpolateHtmlPlugin , which is not present in Parcel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question