I've been trying to code-split my concept website so far, but it just doesn't seem to work. I've got a STLMain component(STLMain.js):
import React from 'react';
export default () => (
<div>
STLMain
</div>
);
Which is used in STLMainLoadable.js:
import React from 'react';
import Loadable from 'react-loadable';
const loading = () => (
<div>
Loading...
</div>
);
export default Loadable({
loader: () => import('./STLMain'),
loading
});
Which is then used in my Router.js
import React from 'react';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import Home from './main_pages/Home';
import NotFound from './main_pages/NotFound';
import STLMainLoadable from './main_pages/STLMainLoadable';
import Navigation from './navigation/Navigation';
export default () => (
<BrowserRouter>
<div>
<Navigation />
<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/STLMain" component={STLMainLoadable} />
<Route component={NotFound} />
</Switch>
</div>
</BrowserRouter>
);
And every time I go to localhost:8080/STLMain I get two errors in the console:
1.GET http://localhost:8080/0.bundle.js 404 (Not Found)
2.Refused to execute script from 'http://localhost:8080/0.bundle.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
And yes, I have syntax-dynamic-import babel plugin installed. What can I do to fix this?