Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack not writing css modules to stats #68

Closed
darekrossman opened this issue Jul 30, 2015 · 1 comment
Closed

Webpack not writing css modules to stats #68

darekrossman opened this issue Jul 30, 2015 · 1 comment

Comments

@darekrossman
Copy link
Contributor

I just can't seem to get webpack to write my css info to webpack-stats.json - my dev config appears to be in order:

var path = require('path');
var Webpack = require('webpack');
var writeStats = require('./utils/writeStats');
var host = 'localhost';
var port = parseInt(process.env.PORT) + 1 || 3001;

module.exports = {
  devtool: 'eval-source-map',
  context: path.resolve(__dirname, '..'),

  entry: [
    'webpack-dev-server/client?http://' + host + ':' + port,
    'webpack/hot/only-dev-server', 
    './js/main.js'
  ],

  resolve: {
    modulesDirectories: [
      'js',
      'node_modules'
    ],
    extensions: ['', '.json', '.js']
  },

  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: 'http://' + host + ':' + port + '/dist/'
  },

  module: {
    loaders: [
      { test: /\.scss$/, loader: 'style!css?modules&importLoaders=2&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true' },
      {test: /\.js$/, exclude: /(node_modules)/, loaders: ['react-hot', 'babel?stage=0&optional[]=runtime']},
      {test: /\.svg$/, loader: 'raw'},
      { test: /\.json$/, loader: 'json-loader' }
    ]
  },

  plugins: [
    new Webpack.HotModuleReplacementPlugin(),
    new Webpack.WatchIgnorePlugin([/\.json$/]),
    new Webpack.NoErrorsPlugin(),
    new Webpack.DefinePlugin({
      __CLIENT__: true, 
      __SERVER__: false,
      __DEVELOPMENT__: true
    }),

    function () {
      this.plugin('done', function(stats) {
        writeStats.call(this, stats, 'dev');
      });
    }
  ]

}

I can require scss files in my components with no problem - but I can't get the server-side bit working as the css block in webpack-stats isn't being populated. Any idea what stupid thing I'm forgetting?

{"script":["http://localhost:5001/dist/bundle.js","http://localhost:5001/dist/0.d881f22741bd91a83a47.hot-update.js"],"css":[]}
@darekrossman
Copy link
Contributor Author

Actually disregard this - I totally missed all the new stuff added to your writeStats utils. Duh.

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

No branches or pull requests

1 participant