0

My project is based on this nice repo - https://github.com/qdouble/angular-webpack2-starter/tree/minimal. And I updated packages to angular 2.2.3, webpack 2.1.0-beta.27 and bootstrap-loader 2.0.0-beta.16. And when I try to build it I get these:

ERROR in ./~/css-loader?sourceMap!./~/resolve-url/resolve-url.js!./~/sass-loader?sourceMap!./src/app/shared/datepicker/datepicker.component.scss Module build failed: ReferenceError: document is not defined

Here's how I use SASS in my components: @Component({ selector: '...', template: `...`, providers: [], encapsulation: ViewEncapsulation.None, styleUrls: ["./datepicker.component.scss"] }) and the datepicker.component.scss file: @import "/node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker3.min.css";

Can someone explain what this error is please?

AlexB
  • 4,167
  • 4
  • 45
  • 117

1 Answers1

0

try: styles: require("./datepicker.component.scss")

That way, a standard webpack configuration can scan for the required files and properly load and link them.

lastWhisper
  • 462
  • 3
  • 6