久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

javascript - webpack打包出現react-dom相關錯誤

瀏覽:106日期:2023-09-25 15:33:29

問題描述

login.js代碼

import React from ’react’;import ReactDOM from ’react-dom’;function tick() { const element = ( <p> <h1>Hello, world!</h1> <h2>It is {new Date().toLocaleTimeString()}.</h2> </p> ); ReactDOM.render( element, document.getElementById(’root’) );}webpack.config.js代碼

const webpack = require(’webpack’);const path=require(’path’);module.exports=(env)=>{ return {entry:{ main:’./login.js’, vendor1:’React’, vendor2:’ReactDOM’},output:{ filename:’[name].bundle.js’, path:path.resolve(__dirname,’dist’)}, module: { rules: [ {test: /.(js|jsx)$/,loader: ’babel-loader’ } ] },plugins:[ new webpack.optimize.CommonsChunkPlugin({name:’manifest’ }),/* new webpack.optimize.CommonsChunkPlugin({name:’vendor1’,minChunks:(module)=>{ return module.context&&module.context.indexOf(’node_modules’)!==-1;} }), new webpack.optimize.CommonsChunkPlugin({name:’vendor2’,minChunks:(module)=>{ return module.context&&module.context.indexOf(’node_modules’)!==-1;} })*/] }}setInterval(tick, 1000);控制臺錯誤

WARNING in D:/node/likeread/~/React/lib/ReactPropTypesSecret.jsThere are multiple modules with names that only differ in casing.This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.Use equal casing. Compare these module identifiers:* D:nodelikereadnode_modulesbabel-loaderlibindex.js!D:nodelikereadnode_modulesReactlibReactPropTypesSecret.js Used by 1 module(s), i. e. D:nodelikereadnode_modulesbabel-loaderlibindex.js!D:nodelikereadnode_modulesReactlibcheckReactTypeSpec.js* D:nodelikereadnode_modulesbabel-loaderlibindex.js!D:nodelikereadnode_modulesreactlibReactPropTypesSecret.js Used by 1 module(s), i. e. D:nodelikereadnode_modulesbabel-loaderlibindex.js!D:nodelikereadnode_modulesreactlibcheckReactTypeSpec.jsERROR in Entry module not found: Error: Can’t resolve ’ReactDOM’ in ’D:nodelikereadpublicjavascripts’

問題解答

回答1:

你把ReactDOM.render()寫在tick方法中是什么意思?

標簽: JavaScript
相關文章:
主站蜘蛛池模板: 湾仔区| 乐清市| 忻州市| 周宁县| 陆丰市| 安义县| 永清县| 奎屯市| 嘉义县| 宜兰市| 堆龙德庆县| 湘潭县| 吉木萨尔县| 松溪县| 贵州省| 兴和县| 尉氏县| 安岳县| 门头沟区| 日照市| 平凉市| 大连市| 新邵县| 武穴市| 师宗县| 香格里拉县| 赣榆县| 绍兴市| 宁城县| 高雄县| 天峻县| 凤冈县| 巩义市| 陕西省| 垣曲县| 玉林市| 梁山县| 云林县| 汉川市| 邢台县| 兴义市|