Skip to content
This repository was archived by the owner on Jul 30, 2022. It is now read-only.
This repository was archived by the owner on Jul 30, 2022. It is now read-only.

npm run package shows empty screen #29

Description

@recodyx

Hello,

after runing npm run build , a dist folder is created and contains files like bundle.js, bundle.css and index.html

But then, if I'm runing npm run prod I see only a blank screen. This happens because the generated index.html is empty:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Webpack App</title>
  <link href="./bundle.css" rel="stylesheet"></head>
  <body>
  <script type="text/javascript" src="./bundle.js"></script></body>
</html>

I believe the cause is index.js

import React from 'react';
import { render } from 'react-dom';
import App from './components/App';

// Since we are using HtmlWebpackPlugin WITHOUT a template, we should create our own root node in the body element before rendering into it
let root = document.createElement('div');
root.id = "root";
document.body.appendChild( root );

// Now we can render our application into it
render( <App />, document.getElementById('root') );

So we need a something like template (index.html) ? Or how can I fix the issue?

P.S. The same issue if I'm using npm run package

Regards
dit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions