Another error occurs as soon as you start an app created using the React app template with authentication.
= to : in ApiAuthorizationConstants.js×
Error: Cannot find module "./components/api-authorization/Login"
â–¼ 13 stack frames were expanded.
./src/components/api-authorization/ApiAuthorizationRoutes.js
https://localhost:44315/static/js/bundle.js:53166:7
__webpack_require__
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:678
fn
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:88
./src/App.js
https://localhost:44315/static/js/bundle.js:51925:111
__webpack_require__
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:678
fn
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:88
./src/index.js
https://localhost:44315/static/js/bundle.js:54708:63
__webpack_require__
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:678
fn
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:88
0
https://localhost:44315/static/js/bundle.js:54860:18
__webpack_require__
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:678
(anonymous function)
C:/W ork/Play/ReactTest1/ClientApp/webpack/bootstrap 43633f0e2b726d97cc14:724
(anonymous function)
https://localhost:44315/static/js/bundle.js:728:10
No error
@javiercn
@javiercn, can you please look into this, as this seems to be related to the new SPA templates area.
Is there a known workaround for this? It may well be very simple, but I'm completely new to React (and to ASP.NET Core, for that matter).
To fix this error change the content of the ApiAuthorizationRoutes.js file
from
import { Login } from './components/api-authorization/login'
import { Logout } from './components/api-authorization/Logout'
to
import { Login } from './Login'
import { Logout } from './Logout'
And change the content of ApiAuthorizationConstants.js file
from
ApiAuthorizationPrefix = prefix,
to
ApiAuthorizationPrefix: prefix,
@mkArtakMSFT @javiercn
Thanks, that works! ESLint also complains about missing semicolons on those lines, by the way.
This is a known issue. Take a look at the list of known issues for more details:
https://github.com/dotnet/core/blob/master/release-notes/3.0/preview/3.0.0-preview-known-issues.md
This is fixed now
Most helpful comment
To fix this error change the content of the ApiAuthorizationRoutes.js file
from
import { Login } from './components/api-authorization/login'import { Logout } from './components/api-authorization/Logout'to
import { Login } from './Login'import { Logout } from './Logout'And change the content of ApiAuthorizationConstants.js file
from
ApiAuthorizationPrefix = prefix,to
ApiAuthorizationPrefix: prefix,@mkArtakMSFT @javiercn