Skip to content

[Enhancement] Webpack and friends as alternative for underlying build/bundling system. #909

Closed
@TheLarkInn

Description

@TheLarkInn

🐘 Alright its time to address the elephant in the room. 🐘

Lets talk about Webpack integration

CLI Is incrediballz, but SystemJS is a less-than-desirable and less-than-configuration-friendly experience.

Use Webpack to have an awesome experience for all environments

CLI was built to make rapid development easy and awesome with Angular and I don't think it should stop there. Out of the box, CLI users should have a bundling system in place that automagically handles giving them a production ready bundle of their Angular code that they spent the tireless 20 command lines to boilerplate.

Things should be easy to configure

Additionally, handling external libraries, build configuration, async module loading, source mapping, code splitting, code sharing, beautifying, etc. should be EASY to reconfigure if a user wants to. Currently it isn't.

Shouldn't replace SystemJS

I do not think that we should rid of SystemJS entirely, however I do believe that it is important that we provide an alternative for people to use. (SystemJS has provided very successful for plunks and apps no larger than 300kb)

ng init --use-webpack

Adding a simple flag like ng init --use-webpack might be a tolerable alternative that people would be more than happy to use.

There are great repo's out there for a starting point

I think @gdi2290 @Foxandxss 's starters are community wide accepted examples of multi environment webpack setups that would be perfect as a starting point. Plus when Weback 2 ships from beta, we'll be able to leverage tree-shaking, async module loading, etc.

I can probably help too

I will add to this issue a more concrete proposal on how Webpack integration might be setup at a high level. (Although really the only thing the user should have to do is ad the --use-webpack flag and everything else should feel or work the same.

@Brocco @hansl we can communicate about this more at length but I'd not only like to hear your thoughts, but community thoughts and opinions as well. Doing this integration the right way should pave the way for giving people the option to have other integrations the right way too.

UPDATE: to add requirements.

Requirements

  • existing preprocessor support
    • less
    • sass
    • compass (?)
    • stylus
    • postcss (with plugins?)
    • style sourcemaps
  • tree-shaking and dead code elimination
    • TS2.0? es6 => es5
    • Babel?
    • tsickle+gcc@advanced?
  • cacheable vendors chunk w/ cache busted main app
  • fast build and serve
    • incremental build and in memory fs cache
    • multicore/cluster/forked worker support
  • support for existing projects
    • migration path (if needed)
    • test against test-app
    • test against material 2
  • 3rd party module support
    • should be as simple as npm install w/ import in app.
    • CommonJS, CommonJS2, AMD, ES6, UMD
  • testing support
    • karma integration
      • configurable karma.conf yet bundle 'protected'
      • w/ Istanbul coverage
    • e2e w/ protractor
  • JS sourcemaps support
    • pre/post trans?
  • dynamic on demand bundles
    • System.import support which creates async dynamic bundle
  • Routing
    • Async Route Handling automagically?
  • ngc support
    • if not ts.LSH support, build step
    • should not be slow
  • asset support
    • assets copied over in distribution bundle
    • automagically resolve images
      • if under x size, base64 and inline image
      • if over x size, serve asset inside of assets folder
      • support for fonts
      • inline SVGs?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions