Webpack compiled build error

Why does test.js (lib/test.js) compiled by webpack go wrong?

fundamental alignment of source code

import React, { Component } from "react"

export default class Test extends Component {
  render() {
    return <h1>Test</h1>
  }
}

erase src/test.js, but make an error after webpack bundle

Error is React.createElement: type is invalid-expected a string

https://github.com/thian4/web.

Feb.28,2021

after reading your question, I began to doubt my Chinese teacher!


clipboard.png
the test.js of your import is packaged. It definitely won't work. You should

import Test from './test'
Menu