Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain the webpack setup #31

Closed
gajus opened this issue Jul 16, 2015 · 5 comments
Closed

Explain the webpack setup #31

gajus opened this issue Jul 16, 2015 · 5 comments

Comments

@gajus
Copy link

gajus commented Jul 16, 2015

In the webpack.config.js you have "angular2" entry.

angular2': [
      'zone.js',
      'reflect-metadata',

      './src/common/BrowserDomAdapter',

      'angular2/angular2',
      'angular2/router',
      'angular2/di',
      'angular2/src/facade/browser'
],

I do not understand whats the purpose of bundling together the following dependencies:

  • 'angular2/angular2'
  • 'angular2/router'
  • 'angular2/di'
  • 'angular2/src/facade/browser'

into a separate script, if you require these using ES6 imports in the script itself, when you use them, e.g. https://github.com/angular-class/angular2-webpack-starter/blob/master/src/app/bootstrap.ts#L4. The end result is that you have multiple declarations of "angular2/*" and those declared as the "angular2" webpack entry are never used.

What are you using './src/common/BrowserDomAdapter' for?

@PatrickJS
Copy link
Owner

I'm using ./src/common/BrowserDomAdapter to ensure that the script being compile is using the correct dom adapter (I had a problem in the past where this was a problem in webpack). And the other files are not needed

@PatrickJS
Copy link
Owner

I removed everything except angular2/angular2
https://github.com/angular-class/angular2-webpack-starter/blob/master/webpack.config.js

    'angular2': [
      // Angular 2 Deps
      'zone.js',
      'reflect-metadata',
      'rtts_assert/rtts_assert',
      'angular2/angular2'
    ],

@gajus
Copy link
Author

gajus commented Jul 19, 2015

I nonetheless do not understand the reason you are including angular2/angular2. Your entry point is your app script. It imports angular2/angular2 using import statement. Unless I am missing something, if you are including angular2/angular2 this way, your script does not even pick it up, i.e. dead weight.

On Jul 19, 2015, at 16:16, PatrickJS notifications@github.com wrote:

I removed everything except angular2/angular2
https://github.com/angular-class/angular2-webpack-starter/blob/master/webpack.config.js

'angular2': [
  // Angular 2 Deps
  'zone.js',
  'reflect-metadata',
  'rtts_assert/rtts_assert',
  'angular2/angular2'
],


Reply to this email directly or view it on GitHub.

@PatrickJS
Copy link
Owner

When webpack generates the file it chunks modules together so I'm forcing Angular to remain in one file for the browser to cache.

@gajus
Copy link
Author

gajus commented Jul 19, 2015

Thats because you are using the plugin. This kinda defeats the purpose of the latter plugin, esp. on a small app.

On Jul 19, 2015, at 18:00, PatrickJS notifications@github.com wrote:

When webpack generates the file it chunks modules together so I'm forcing Angular to remain in one file for the browser to cache.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants