![](/img/trans.png)
[英]react-app-rewired used to enable web workers fails to build
[英]How to change build path for react-app-rewired
我正在嘗試在文件config-overrides.json
中更改react-app-rewired
的構建路徑,如此處所述。
module.exports = {
paths: function (paths, env) {
paths.appBuild = 'C:\\Projects\\jhipster\\src\\main\\webapp\\app';
return paths;
}
};
但它沒有被考慮在內,我收到以下錯誤:
Could not find a required file.
Name: index.html
Searched in: C:\Projects\jhipster\public
我直接硬編碼路徑只是為了測試它是否有效。
我遺漏了什么嗎?
該問題實際上與構建路徑無關。 問題是 React 期望有一個public/index.html
文件但找不到任何這樣的文件。 我猜你要么重命名了public
,要么將index.html
移到了其他地方。
解決方案:告訴react-app-rewired
rewired 在哪里可以找到index.html
。
// config-overrides.json
module.exports = {
paths: function (paths, env) {
paths.appBuild = 'C:\\Projects\\jhipster\\src\\main\\webapp\\app';
// Tell the app where our public folder is
paths.appPublic = 'path_to_public_folder';
// Tell the app where our index.html is
path.appHtml = 'path_to_index.html';
return paths;
}
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.