簡體   English   中英

在 create-react-app 彈出 appHtml 后沒有被復制

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM