Webpack: a dependency request is an expression

I implemented React-router 1.0 in that I implemented a router, for example

import React, { PropTypes, Component } from 'react';
import { Router, Route } from 'react-router';

import App from './App';
import RepoPage from './pages/RepoPage';
import UserPage from './pages/UserPage';
import TaskList from './pages/TaskList';

var data=[{path:'/:UserPage/:Id',PageUrl:'./pages/UserPage'},
          {path:'/:RepoPage/:Id',PageUrl:'./pages/RepoPage'}
        ];
export default class Root extends Component {
  static propTypes = {
    history: PropTypes.object.isRequired
  }

  render() {
    const { history } = this.props;
    const ts=Object.keys(data).map(function(d){
        return(
             <Route path={data[d].path} component={require(data[d].PageUrl)} />
          );
       });
    return (
      <Router history={history}>
        <Route  path='/' component={TaskList}>
        </Route>
        <Route>
           {ts}
        </Route>
      </Router>
    )
  }
}

as you can see in my code, I create the ts variable and use this ts in the render return function if I use it so that it gives me a warning, for example

Webpack: dependency request is an expression

if I comment on this ts execution code then it will not give any warning. can someone please let me know what is the problem with him enter image description here

+4
source share

Source: https://habr.com/ru/post/1619026/


All Articles