简体   繁体   English

将 Webpack 添加到现有的 React 应用程序

[英]Adding Webpack to existing React app

So I have built the first piece of an app using create-react-app .所以我使用create-react-app构建了应用程序的第一部分。 It by default is using npm for building, running locally, etc...默认情况下,它使用npm进行构建、本地运行等...

What I want to do is to move to using Webpack, but not breaking the existing setup and have done some googling, but nothing starts and goes step by step so I can get a better feel for what it is doing and where it is going.我想要做的是转向使用 Webpack,但不破坏现有设置并进行了一些谷歌搜索,但没有任何开始和逐步进行,这样我就可以更好地了解它正在做什么以及它要去哪里。 Would like to also incorporate using webpack-dev-server with this as well.还想将使用webpack-dev-server与此合并。

That said, I was hoping you guys had some recommendations and maybe also point out some good tutorials for this moving forward?也就是说,我希望你们有一些建议,也许还可以指出一些很好的教程来推动这一进程?

Thanks much.非常感谢。

Create react app uses Webpack.创建 React 应用程序使用 Webpack。 If you want to modify Webpack.config for this project you can run yarn eject/npm eject from here on you are responsible for the Webpack.config so it will be harder to update react scripts.如果你想修改这个项目的 Webpack.config,你可以从这里运行 yarn eject/npm eject,你负责 Webpack.config,这样更新反应脚本会更困难。

If you don't want to be responsible for the Webpack.config you could try to use react-app-rewired.如果你不想对 Webpack.config 负责,你可以尝试使用 react-app-rewired。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM