Skip to content
This repository has been archived by the owner on Apr 16, 2019. It is now read-only.

How do you use this with webpack 2? #1

Closed
ciocan opened this issue Feb 26, 2017 · 10 comments
Closed

How do you use this with webpack 2? #1

ciocan opened this issue Feb 26, 2017 · 10 comments

Comments

@ciocan
Copy link

ciocan commented Feb 26, 2017

No description provided.

@shepherdwind
Copy link
Owner

Sorry, This loader just worked on webpack 1.x . I don't use webpack 2 yet.

I will try to resolve the problem soon.

@faceyspacey
Copy link

where do you put the loader here for example:

{
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
          fallback: "style-loader",
          use: "css-loader?modules&localIdentName=[name]__[local]--[hash:base64:5]"
        })
      },

@shepherdwind
Copy link
Owner

@faceyspacey webpack 2.x can use those config

module: {
  rules: [
    {
      test: /\.css$/,
      use: ['css-hot-loader'].concat(ExtractTextPlugin.extract({
        fallback: 'style-loader',
        use: 'css-loader'
      })),
    },
  ]
}

Please use version 1.0.2 .

@faceyspacey
Copy link

awesome! trying it now.

@shepherdwind
Copy link
Owner

@ciocan I am sorry, I just forget to fix this issue .

@faceyspacey
Copy link

faceyspacey commented Apr 5, 2017

It's not working for me. No stylesheet is appearing in the head.

Here's what I have:

{
        test: /\.css$/,
        use: ['css-hot-loader'].concat(ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: 'css-loader?modules&localIdentName=[name]__[local]--[hash:base64:5]'
        }))
      },
  ]
},
plugins: [
    new ExtractTextPlugin({
      filename: '[name].css',
    }),
...

@faceyspacey
Copy link

faceyspacey commented Apr 5, 2017

In fact, it seems to break HMR for even javascript. HMR does not work at all after installing this. And I've tested to make sure regular HMR for js and css works--here's my regular css loader commented out:

// {
//   test: /\.css$/,
//   exclude: /node_modules/,
//   loaders: [
//     'style-loader',
//     'css-loader?modules&localIdentName=[name]__[local]--[hash:base64:5]',
//   ],
// },

@shepherdwind
Copy link
Owner

@faceyspacey Can You send me a tiny demo? So I can try this on my compute .

If it is convenient for you, send code to my email(eward.song at gmail.com) or just give me a url which I can find the demo code.

@shepherdwind
Copy link
Owner

Here https://github.com/shepherdwind/react-hot-boilerplate/tree/next is my demo code, which css and js are all work fine .

@faceyspacey
Copy link

ok, I'm going to try it tomorrow as it's the end of my day, but something tells me it has to do with allChunks: false in mine since your example has allChunks: true. ...i'm working on a PR to output a css file per chunk rather than a single one--i wonder how your plugin will behave then.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants