HackImti
HackImti

Reputation: 87

.css was not loaded because its MIME type, “text/html”, is not “text/css”. and SyntaxError: expected expression, got '<'

Everything's working fine in localhost. That's why can't test frequently. S3 auto build creating text/html instead of text/css only for multiple slashed path like xdomain.com/callback/google/signup and facing the error below:

The stylesheet https://xdomain.com/callback/google/signup/static/css/2.40dccbaa.chunk.css was not loaded because its MIME type, “text/html”, is not “text/css”.

same for this page's js file showing SyntaxError: expected expression, got '<' error.

all other path like https://xdomain.com/home or https://xdomain.com/dashboard working fine.

I can't fix how to solve this css or js path for multiple slashed path url page.

import "./GoogleSignupCallback.scss"; // that's how i import scss file in different pages.

App.js file

import React from "react";
import {
  BrowserRouter as Router,
  Switch,
  Route,
  Redirect,
} from "react-router-dom";
import "./scss/common.scss";
import Home from "./views/Home";
import GoogleSingupCallback from "./views/SNS/GoogleSignupCallback/index";
import Cms from "./views/Cms/index";

const App = () => {
  return (
    <Router>
      <Switch>
        <Route exact path="/" component={Home} />
        <Route exact path="/cms" component={Cms} />
        <Route exact path="/callback/google/signup" component={GoogleSingupCallback} />

        <Redirect to="/" />
      </Switch>
    </Router>
  );
};

export default App;

Help please.

Upvotes: 2

Views: 2070

Answers (1)

Y H
Y H

Reputation: 632

Do you have a "homepage" listed in you package.json?

Try to remove it or set it to "/".

Upvotes: 3

Related Questions