create-react-app多页面配置

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

内容简介:通过各种百度, 整理出一份配置步骤,望有助于需要的朋友当前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 @陌路


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

查看所有标签

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

Agile Web Development with Rails 4

Agile Web Development with Rails 4

Sam Ruby、Dave Thomas、David Heinemeier Hansson / Pragmatic Bookshelf / 2013-10-11 / USD 43.95

Ruby on Rails helps you produce high-quality, beautiful-looking web applications quickly. You concentrate on creating the application, and Rails takes care of the details. Tens of thousands of deve......一起来看看 《Agile Web Development with Rails 4》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具