```
TypeError: Cannot read property 'length' of undefined
```
```
if (webpackConfigurationValidationErrors.length) {
^
TypeError: Cannot read property 'length' of undefined
at processConfiguredOptions (E:\Vue7\react108\node_modules\webpack-cli\bin\convert-argv.js:160:44)
at module.exports (E:\Vue7\react108\node_modules\webpack-cli\bin\convert-argv.js:150:10)
at Object.<anonymous> (E:\Vue7\react108\node_modules\webpack-dev-server\bin\webpack-dev-server.js:84:40)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react108@1.0.0 dev3: `webpack-dev-server --hot --mode development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react108@1.0.0 dev3 script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-10-08T08_31_03_073Z-debug.log
```
```
npm.cmd install
```
```
npm.cmd update
```
```
npm.cmd run dev3
```
```
> webpack-dev-server --hot --mode development
10% building 0/1 entries 0/0 dependencies 0/0 modulesi 「wds」: Project is running at http://localhost:8080/
```
package.json
```
{
"name": "react108",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack",
"dev1": "webpack --watch",
"dev2": "webpack-cli --hot --mode development",
"dev3": "webpack-dev-server --hot --mode development"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.26.1",
"html-webpack-plugin": "^5.3.2",
"webpack": "^5.58.0",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2"
},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
}
```
webpack.config.js
```
var path = require('path');
var webpack = require('webpack');
var HtmlwebpackPlugin = require('html-webpack-plugin');
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH,'src');
var BUILD_PATH = path.resolve(ROOT_PATH,'build');
module.exports = {
entry:{
app:path.resolve(APP_PATH,'index.jsx')
},
output:{
path:BUILD_PATH,
filename:'bundle.js'
},
devtool:'eval-source-map',
devServer:{
historyApiFallback:true,
hot:true,
progress:true
},
module:{
// preLoaders:[
// {
// test:/\.jsx?$/,
// loader:['eslint'],
// include:APP_PATH
// }
// ],
rules:[
{
test:/\.jsx?$/,
loader:'babel-loader',
include:APP_PATH
}
],
// plugins:[
// new HtmlwebpackPlugin({
// title:'my first react app'
// })
// ],
// resolve:{
// extensions:['','.js','jsx']
// }
}
}
```
.babelrc
```
{
"presets":["es2015","react"]
}
```
.eslintrc
```
{
"extends":"airbnb",
"rules":{
"comma-dangle":["error","never"]
}
}
```
```
D:\HBuilderX\plugins\npm\npm.cmd init -yes
npm.cmd install webpack --save-dev
npm.cmd install webpack-cli --save-dev
"dev":"webpack",
"dev1":"webpack --watch",
"dev2":"webpack-dev-server --hot --mode development"
npm.cmd install webpack-dev-server --save-dev
新建 src
新建 index.js
新建 hello.js
npm.cmd install babel-core babel-loader --save-dev
npm.cmd install babel-preset-es2015 babel-preset-react --save-dev
.babelrc
{
"presets":["es2015","react"]
}
npm.cmd install eslint eslint-loader --save-dev
eslint-webpack-plugin
Please install eslint-plugin-jsx-a11y'
Please use eslint-webpack-plugin
npm.cmd install eslint-plugin-import eslint-plugin-react eslint-plugin-jsx-a11y --save-dev
.eslintrc
npm.cmd install eslint-config-airbnb --save-dev
{
"extends":"airbnb",
"rules":{
"comma-dangle":["error","never"]
}
}
npm.cmd install html-webpack-plugin --save-dev
webpack.config.js
webpack-cli --hot --mode development
npm.cmd install react react-dom --save
npm.cmd install babel-loader@7 --save-dev
install webpack@5.57.1 -D
npm.cmd install
npm.cmd update
npm.cmd run dev3
```
- uniapp引入vant
- 组件 vanButton 引用错误,仅支持 import 方式引入组件
- 构建npm
- 页面跳转
- 启动本地数据
- 有赞商城小程序使用教程
- 使用vant组件
- 购物车
- errno: -4082,
- buy
- qiang
- qiangbuy
- 设置数据
- React.createElement: type is invalid -- expected a string
- index.jsx: Expected corresponding JSX closing tag for <img>
- ReferenceError: FieldSet is not defined
- Identifier 'useState' has already been declared
- React does not recognize the classNam prop on a DOM element
- Invalid hook call. Hooks can only be called inside of the body of a function component
- created不能调用 setData
- TypeError: Cannot read property 'props' of undefined
- Missing semicolon
- form = Form.useForm(FormStrategy.View);
- useState is not a function
- useCallback is not defined
- Button is not defined
- form方案一
- props is not defined
- value_i
- super
- this_state
- Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
- Expected onClick listener to be a function, instead got a value of string type.
- getzhi is not defined
- this.setStatus is not a function
- this.state is null
- onClick_props
- fill
- slice深拷贝
- concat
- Cannot update during an existing state transition (such as within render). Render methods should be a pure function of props and state
- this.props.onClick is not a function
- The above error occurred in the <Skt> component
- The above error occurred in the <Bight> component
- onClick
- assignment to undeclared variable hispldy
- Each child in a list should have a unique "key" prop.
- Module not found: Error: Can't resolve './react' in
- 页面空白
- SyntaxError: index915.jsx: Unexpected token
- Identifier 'PropTypes' has already been de clared
- Identifier 'Profile' has already been decl ared
- JSX value should be either an expression or a quoted JSX text
- react__WEBPACK_IMPORTED_MODULE_9__.PropTypes is undefined
- SyntaxError: index1.jsx: Missing semicolon
- function map
- import from function
- 生成数组
- 使用两个循环来渲染出棋盘的格子,而不是在代码里写死
- Nothing was returned from render
- Uncaught TypeError: this is undefined
- if替代
- string refs. We recommend using useRef() instead
- Uncaught ReferenceError: useRef is not defined
- dangerouslySetInnerHTML
- handleClick
- 注释代码
- Invalid DOM property for. Did you mean htmlFor
- Received false for a non-boolean attribute className.
- style
- React.createClass is not a function
- '$' is not defined
- this.getDOMNode is not a function
- Autocomplete
- react and webpack
- react3\node_modules\babel doesn't exist
- babel-loader@8 requires Babel 7.x
- options has an unknown property 'progress'. These properties are valid:
- webpack cli
- Unable to load '@webpack-cli/serve' command
- npm install babel-preset-react-hmre --save-dev
- "dev": "webpack-dev-server --hot --mode development",
- npm run dev
- // Imports
- Error: Cannot find module 'webpack-cli/bin/config-yargs'
- super() outside of class constructor
- Error: Cannot find module 'webpack-cli/bin/config-yargs'two
- TypeError: Cannot read property 'length' of undefined
- configuration.module has an unknown property 'resolve'. These properties are valid
- Please use eslint-webpack-plugin
- Class Profile extends React.Component
- Uncaught ReferenceError: domcument is not defined
- Profile ...user
- Profile
- document.body.appendChild
- react.PropTypes is undefined
- ReferenceError: propTypes is not defined
- Warning: Component Profile declared PropTypes instead of propTypes. Did you misspell the property assignment?
- state Uncaught TypeError: this is undefined
- componentDidMount
- Component Hobby declared PropTypes instead of propTypes. Did you misspell the property assignment
- this.state.hobbis.map
- function Hobby
- 跳转为空白hobbis.push(this.refs.hobby)
- You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file
- 空白排查
- SyntaxError: ItemEditor/index.jsx: Unexpected token
- ...item
- Warning: Failed prop type: The prop onCancel is marked as required in ItemEditor, but its value is undefined
- Uncaught TypeError: _uuid2.default is undefined
- a标签的onclick事件触发请求