0

I recently moved my Angular 2 project from SystemJS to Webpack, using the most recent version of Angular2-CLI. The project files were barely changed, and only small changes within the Angular2 code were made to fit the project into the new environment.

However, now when I bundle using the CLI and run it, I get some weird behaviors on the design of the page. I compared the styles of both pages and they're identical 1 by 1, so that means there's something with Webpack or the CLI that's messing with the site's appearance and structure.

fingeron
  • 1,152
  • 1
  • 9
  • 20
  • Can we have at least the minimum code required to reproduce this behavior? Specific CLI versions and dependencies are very important to this. Also, do you use a CSS pre-processor like SASS or CSSNext? – gelliott181 Oct 05 '16 at 16:20

1 Answers1

0

The webpack version no longer has a vendor directory so relative scripts tags for 3rd party libraries will break. You'll need to change how your 3rd party libraries are included. Either import your libraries (css and js) or tell angular-cli to load them as part of the configuration. See https://github.com/angular/angular-cli#3rd-party-library-installation and https://github.com/angular/angular-cli#global-library-installation

shusson
  • 5,542
  • 34
  • 38
  • The design is not related to any 3rd party library, it's all supposed to be plain CSS (written by me and not an open source code). Also, the issue the brought me to this question is that I compared between the website before the Webpack bundle (using systemjs) and after the webpack bundle, and even though **every line of CSS is similar**, the website looks different and some behaviors (like scroll) are _gone_! – fingeron Oct 09 '16 at 07:04
  • how are you including your css? – shusson Oct 09 '16 at 10:56
  • @Component({...styleUrls: ["file.scss"]...}) – fingeron Oct 10 '16 at 12:05
  • and what about in the `angular-cli.json` ? – shusson Oct 10 '16 at 23:23
  • There's only one global CSS file and all it affects is the "html" and "body" tags – fingeron Oct 13 '16 at 07:33