leecade / leecade/es6-study

import `React` 否则 babel-loader 打包完会报错

Open
#1 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
35
Forks
7
PR merge metrics
No merged PRs in 30d

Description

index.js 如果没有 import 出 React :

import { Component } from 'react'

babel-loader 打包完后会报:

Uncaught ReferenceError: React is not defined

So:

import React, { Component } from 'react'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open index.js and review the React import used with babel-loader. Make the import include the React namespace, then run the project’s build to confirm the bundled code no longer raises “React is not defined”.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript, react
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.