0

I have a problem with angular 2 and webpack. The problem is that if I use relative paths in my css file like "background: url("./../images/squares.gif") center left no-repeat;" I get errors when I build the app:

"15% 19/206 build modulesModuleBuildError: Module build failed: SyntaxError: Unexpected token ILLEGAL"

my webpack config is:

loaders: [
...
            {
                test: /\.css$/,
                exclude: helpers.root('src', 'app'),
                loaders:[ExtractTextPlugin.extract('style', 'css-loader'), 'to-string', 'css']
            },
            {
                test: /\.css$/,
                include: helpers.root('src', 'app'),
                loader: ['raw']
            }
...
]

Can anybody help me?

Thanks in advance!

Egor
  • 2,122
  • 2
  • 21
  • 23
  • Have a look at this thread: https://github.com/AngularClass/angular2-webpack-starter/issues/759 This would help you. – Bharat Sep 28 '16 at 05:09

1 Answers1

0

I managed to it by changing:

this

{
   test: /\.css$/,
   exclude: helpers.root('src', 'app'),
   loaders:[ExtractTextPlugin.extract('style', 'css-loader'), 'to-string', 'css']
}

to

{
  test: /\.css$/,
  exclude: helpers.root('src', 'app'),
  loader: 'style-loader!css-loader'
}
Egor
  • 2,122
  • 2
  • 21
  • 23