shepherdwind / css-hot-loader

This is a css hot loader, which support hot module replacement for an extracted css file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fileMap broken?

chasegiunta opened this issue · comments

@shepherdwind would you mind providing a full example for this option? I'm able to get css-hot-loader working great normally, but with the filemap option, I'm having trouble.

'js/main':  './src/js/main.js',
'css/main': './src/scss/main.scss'

If the above are my entry points, I would assume I could do something like

{
  test: /\.scss$/,
  use: [
    { 
      loader: 'css-hot-loader',
      options: {
        fileMap: '../{fileName}'
      }
    }].concat(ExtractTextPlugin.extract(
    {
      fallback: 'style-loader',
      use: ['css-loader', 'sass-loader']
     }
  )),
}
commented

I add an example for how to use fileMap option, https://github.com/shepherdwind/css-hot-loader/tree/master/examples/commons-chunk .

I don't see all you webpack config file, so I just can not find out why your config work fail. Try my example and maybe you can find out the solution. Or give me an example which I can run on my compute, I will check it what is the problem.

Wasn't the fileMap option put in to solve the problem of entry points & output in separate folders? #3

My entry points are in separated into js & css folders respectively. The example you provided places common and index entry files in the same /src/ folder, and outputs both into the same /dist/ folder. Thanks for your help & work on this.

commented

My example css file output to css dir, and js output to dist dir.

new ExtractTextWebpackPlugin('css/[name].css'),

I think the entry file path should not affect big much.

You're right. I figured it out. I had the incorrect path here new ExtractTextWebpackPlugin('css/[name].css'). I was missing the css/ prefix. Thanks!