GithubHelp home page GithubHelp logo

Comments (5)

brabra avatar brabra commented on May 13, 2024 1

Thanks a lot, It's work!😊

from code-splitting-react-webpack.

brotzky avatar brotzky commented on May 13, 2024

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.

brabra avatar brabra commented on May 13, 2024

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.

brotzky avatar brotzky commented on May 13, 2024

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.

brotzky avatar brotzky commented on May 13, 2024

You're welcome :)

from code-splitting-react-webpack.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.