I am using angular2 template installation in visual studio ( https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ASPNETCoreTemplatePack ) for my project. I want to intergrate SASS, but he threw the exception " Node call module failed with error: Prerendering failed due to error: ReferenceError: window not defined ".
This file webpack.config.js:
var sharedConfig = {
resolve: { extensions: [ '', '.js', '.ts' ] },
output: {
filename: '[name].js',
publicPath: '/dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
},
module: {
loaders: [
{ test: /\.ts$/, include: /ClientApp/, loader: 'ts', query: { silent: true } },
{ test: /\.html$/, loader: 'raw' },
{ test: /\.css$/, loader: 'to-string!css' },
{ test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url', query: { limit: 25000 } },
{ test: /\.scss$/, loaders: ["style-loader", "css-loader", "sass-loader"] }
]
}
};
and home.component.ts
@Component({
selector: 'home',
template: require('./home.component.html'),
styles: [require('./home.component.scss')]
})
source
share