create-react-app多页面配置

栏目: IOS · Android · 发布时间: 6年前

内容简介:通过各种百度, 整理出一份配置步骤,望有助于需要的朋友当前create-react-app v 3.0.1//基本步骤

通过各种百度, 整理出一份配置步骤,望有助于需要的朋友

当前create-react-app v 3.0.1

//基本步骤

create-react-app test

cd test

npm run eject

//调整webpack.config.js的几个地方

1, entry 由数组修改成对象形式

create-react-app多页面配置

2, output的修改

create-react-app多页面配置

修改成

create-react-app多页面配置

3, HtmlWebpackPlugin

index默认的修改成如 图:

create-react-app多页面配置

自己添加的一份demo

create-react-app多页面配置

至此, 添加了一份demo的配置就完成了, 可以访问

首页 localhost:3000/index.html
demo页: localhost:3000/demo.html

无需像网上及webpack文档说的,dev下还需要修改hot配置页面

另外,如果有需求像访问 localhost:3000/demo/index.html 这样的地方,只需要针对上面的步骤修改一个地方即可

create-react-app多页面配置

有问题欢迎加群 2751786 @陌路


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Programming the Mobile Web

Programming the Mobile Web

Maximiliano Firtman / O'Reilly Media / 2010-07-23 / $44.99

* Learn how to use your existing skills to move into mobile web development * Discover the new possibilities of mobile web development, and understand its limitations * Get detailed coverage of ......一起来看看 《Programming the Mobile Web》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具