![](/img/trans.png)
[英]How to use jsx files in an app created by create-react-app (without run “npm run eject”)?
[英]After create-react-app eject appHtml is not copied
有人知道,為什么在 create-react-app 中彈出后會在 build.js 中創建appHtml
的過濾器?
function copyPublicFolder() {
fs.copySync(paths.appPublic, paths.appBuild, {
dereference: true,
filter: file => file !== paths.appHtml,
});
}
我確實彈出了,因為對我來說appHtml
(public/index.html) 不是我的 react 應用程序的入口點,我需要更改webpack.config.js
中的HtmlWebpackPlugin
部分。 但是現在我看到了這個過濾,因此我的index.html
沒有被復制到build
目錄中,但我想知道這是否會對我的應用程序產生任何其他影響?!
一年后我發現了你的問題。 讓我知道你是否從那以后解決了它。 我的解決方法是更改package.json
中的scripts.build
值。 見下文:
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js && mv build/index.html build/testpage.html",
"test": "node scripts/test.js"
}
編輯:“幾年后我發現了你的問題”,哈哈!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.