Comments (5)
Thanks a lot, It's work!😊
from code-splitting-react-webpack.
This would work with no issues from what I've tried.
<Route path="/about" getComponent = {(location, cb)=>{
System.import('./components/About')
.then(loadRoute(cb))
.catch(errorLoading);
} }/>
<Route path="/about/page" getComponent = {(location, cb)=>{
System.import('./components/AboutPage')
.then(loadRoute(cb))
.catch(errorLoading);
} }/>
from code-splitting-react-webpack.
It can only compile successful, but when I visit 'localhost:3000/about/page', the console report: 'app.d83ec07….js:1 Uncaught SyntaxError: Unexpected token <'
So I have checked the source in console of 'localhost:3000/about/page', I found the 'vendor..js' and 'index..js' is same as 'index.html',
their source code:(vendor..js, index..js, page)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Code Splitting</title>
</head>
<body>
<!-- The mounting div of our React app -->
<div id="App"></div>
<script type="text/javascript" src="vendor.caad40ab705e4f9d77a1.js"></script><script type="text/javascript" src="app.caad40ab705e4f9d77a1.js"></script></body>
</html>
from code-splitting-react-webpack.
Try uncommenting this line:
https://github.com/brotzky/code-splitting-react-webpack/blob/master/webpack/webpack.config.js#L32
It should hopefully solve your issue.
from code-splitting-react-webpack.
You're welcome :)
from code-splitting-react-webpack.
Related Issues (8)
- React-router v4 HOT 2
- Uncaught error: Dynamic page loading failed: undefined HOT 2
- loadRoute 2nd parameter in about page? HOT 1
- Add ES6 sintax HOT 2
- Merge conflict in yarn.lock file. HOT 2
- [Question] Deploying the app in production HOT 1
- How should I compile the routes to [name].[chunk].js instead of [number].[chunk].js? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code-splitting-react-webpack.