Giter Site home page Giter Site logo

Comments (4)

aaronallport avatar aaronallport commented on July 20, 2024

That'll be RequireJS - a view source will show just the one script in play, whilst requirejs is actually inserting those scripts in to the DOM at run-time. If you build your app and run from dist, you should see the one, compressed build JS being used instead.

As both page1 and page2 are essentially views in your SPA, you;ll get them both downloaded when running from the app folder.

Sorry if that didn't make sense - it's late here. If you would like me to clarify further, I'd be happy to tomorrow.

from generator-angular-require.

scottnath avatar scottnath commented on July 20, 2024

Thanks @aaronallport , I have a couple more questions if you don't mind...

  1. If the system then loads each view, then what is the "lazy loading" part of this? What is loading as-needed?
  2. Running from dist: I've tried to open /dist/index.html, but the page is still pointing to the bower_components require js in the folder above:
    <script src="bower_components/requirejs/require.js" data-main="scripts/main"></script>
  • Is there something else I need to do to run from dist?
  • I tried pointing that line to scripts/main.js, but that just gave an error:

Uncaught ReferenceError: define is not defined main.js:6

thanks,
Scott

from generator-angular-require.

aaronallport avatar aaronallport commented on July 20, 2024

Hi Scott, take a look at the latest version - you'll hopefully notice that point 2 is fixed. As for point 1, only requirejs is in the bower_components directory under dist - this is so that the script tag to load requirejs in the index.html file doesn't need to be updated when building.

Cheers,

Aaron

from generator-angular-require.

scottnath avatar scottnath commented on July 20, 2024

Thank you Aaron!

Due to expanding requirements for our internal Angular apps, I've had to move forward with building our own system. So, I've been putting all my efforts into this:
scottnath/atlas

Thank you for fixing that, it will help me with some personal projects!

-Scott

from generator-angular-require.

Related Issues (20)

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.