标签: react-boilerplate

如何将公共文件夹添加到 react-boilerplate webpack 配置?

我正在使用 react 和它的样板react-boilerplate设置一个新的网络应用程序。现在我想在包含 index.html 以及 robots.txt .htaccess 文件和一些外部 js 库的根目录中添加一个公共文件夹。有人可以指导我编辑 webpack 配置文件以使其行为如此。

提前致谢

reactjs webpack react-boilerplate

5
推荐指数
1
解决办法
3265
查看次数

无法正确设置反应样板:“npm ERR!ngrok - 不支持平台darwinarm64。”

我正在尝试在新的 M1 Max MacBook Pro 上首次设置反应样板,并在运行后继续收到此错误消息npm run setup


    npm ERR! code 1
    npm ERR! path /Users/ssc/Documents/Development/website/node_modules/ngrok
    npm ERR! command failed
    npm ERR! command sh -c node ./postinstall.js
    npm ERR! ngrok - platform darwinarm64 is not supported.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/ssc/.npm/_logs/2021-10-31T06_18_18_426Z-debug.log

Run Code Online (Sandbox Code Playgroud)

我一直无法解决这个问题。任何帮助将不胜感激。

ngrok react-boilerplate apple-m1

5
推荐指数
1
解决办法
3890
查看次数

模块解析失败:错误:semantic/dist/semantic.min.css 意外字符 '@' (11:0)

我使用当前版本的 react-boilerplate(使用 webpack)并安装了 Semantic-UI-React,如官方文档http://react.semantic-ui.com/usage 中所述

当我启动服务器时,我得到:

Server started ! ?

Access URLs:
-----------------------------------
Localhost: http://localhost:3000
      LAN: http://192.168.100.103:3000
-----------------------------------
Press CTRL-C to stop

webpack built dba595efb772df0727e8 in 11657ms

ERROR in ./semantic/dist/semantic.min.css
Module parse failed: /Users/standardnerd/development/template/semantic/dist/semantic.min.css Unexpected character '@' (11:0)
You may need an appropriate loader to handle this file type.
|  *
|  */
| @import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin);/*!
|  * # Semantic UI 2.2.7 - Reset
|  * http://github.com/semantic-org/semantic-ui/
 @ ./app/app.js 20:0-43
 @ multi main
Run Code Online (Sandbox Code Playgroud)

我需要什么样的“合适的装载机”?

解析器不喜欢 /semantic/dist/semantic.min.css 中的 @import 语句: …

semantic-ui webpack react-boilerplate semantic-ui-react

4
推荐指数
1
解决办法
5482
查看次数

React中的Favicon不会更新

我无法在反应样板中更新收藏夹图标。

我用自己的文件替换了images / app / favicon.ico中的文件,但仍然看到旧图标。

我清除了浏览器缓存,然后运行npm run build:cleannpm run build

无法呈现我的新收藏夹图标。请告知如何更新网站图标。

html favicon reactjs react-boilerplate

4
推荐指数
2
解决办法
1231
查看次数

Internet Explorer的Redux-Saga

我在IE 11中有一个使用redux-saga的React应用

它似乎因以下错误而中断

请注意,此应用程序在最近3年的Chrome版本中以及在Safari中都可以完美运行(除了某些显示问题)

sagas.js

// functions are called bottom to top, this one is called at the end (also can be seen in stack trace below)

function* getGlobalData() {
    console.log('Get global data called');      // this is executed

    // something is failing from here on

    const [
      wardrobeResponse,
      lastListingsResponse,
    ]  = yield [
      call(api_request, {url: 'store/wardrobes/'}),
      call(api_request, {url: 'store/last_listings/'}),
    ]


    yield put(actions.wardrobe.success(wardrobeResponse.json));
    yield put(actions.lastListings.success(lastListingsResponse.json));



}

/**
 * Watches for LOAD_SEARCH_RESULTS action and calls handler
 */
function* getGlobalDataWatcher() {

    console.log('Get data …
Run Code Online (Sandbox Code Playgroud)

reactjs redux redux-saga react-redux react-boilerplate

3
推荐指数
1
解决办法
2372
查看次数

DropdownButton,来自“ react-bootstrap”的MenuItem;

在这里将onSelect放入MenuItemDropdownButton的位置

在这个简单的示例中,当用户选择menuitem时,它不会反映到下拉按钮中。

在onSelect或onChange上有示例吗?

<div className="select_option">
    <label htmlFor="type">Document Desc</label>
    <DropdownButton title="--Select One--" id="document-type">
        <MenuItem>Item 1</MenuItem>
        <MenuItem>Item 2</MenuItem>
        <MenuItem>Item 3</MenuItem>
        <MenuItem>Item 4</MenuItem>
    </DropdownButton>
</div>
Run Code Online (Sandbox Code Playgroud)

reactjs react-bootstrap react-boilerplate

2
推荐指数
1
解决办法
4759
查看次数

使用 webpack ProvidePlugin 全局导入 javascript 文件

我有一个进行网络调用的功能,我希望该功能在全球范围内可用,而不必每次需要使用该功能时都导入它

请求.js

import 'whatwg-fetch';

/**
 * Parses the JSON returned by a network request
 *
 * @param  {object} response A response from a network request
 *
 * @return {object}          The parsed JSON from the request
 */
function parseJSON(response) {
  if (response.status === 204 || response.status === 205) {
    return null;
  }
  return response.json();
}

/**
 * Checks if a network request came back fine, and throws an error if not
 *
 * @param  {object} response   A response from a network …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs webpack react-boilerplate webpack-plugin

2
推荐指数
1
解决办法
996
查看次数

在反应样板中实现 axios 拦截器的最佳方式是什么?

我正在使用使用 fetch 库的 react 样板。但是现在我想实现拦截器,有没有人知道如何使用 fetch 库来实现它,或者我应该为此使用 axios。

fetch reactjs react-native axios react-boilerplate

1
推荐指数
1
解决办法
2531
查看次数

react-boilerplate 错误:无法解析“/Users/react-boilerplate/node_modules/xlsx-style”中的“../xlsx”

我在运行npm install时正在使用 react-boilerplate我看到这些错误

    Building the Webpack DLL...
Hash: 7f68501fbcd6b8f05530
Version: webpack 4.12.0
Time: 3566ms
Built at: 08/05/2018 6:10:17 PM
                      Asset      Size                Chunks                    Chunk Names
reactBoilerplateDeps.dll.js  4.81 MiB  reactBoilerplateDeps  [emitted]  [big]  reactBoilerplateDeps
chunk {reactBoilerplateDeps} reactBoilerplateDeps.dll.js (reactBoilerplateDeps) 4.15 MiB [entry] [rendered]

WARNING in ./node_modules/xlsx-style/ods.js
Module not found: Error: Can't resolve '../xlsx' in '/Users/mehrnooshhajkhalil/react-boilerplate/node_modules/xlsx-style'
 @ ./node_modules/xlsx-style/ods.js
 @ ./node_modules/xlsx-style/xlsx.js
 @ ./node_modules/node-excel-export/lib/excel.js
 @ ./node_modules/node-excel-export/index.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/xlsx-style/dist/cpexcel.js
Module not found: Error: Can't resolve './cptable' in '/Users/mehrnooshhajkhalil/react-boilerplate/node_modules/xlsx-style/dist'
 @ ./node_modules/xlsx-style/dist/cpexcel.js 807:16-41
 @ …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs webpack react-boilerplate

1
推荐指数
1
解决办法
1万
查看次数