SimonDegraeve / hapi-webpack-plugin

Webpack middleware for Hapi. Supports HMR.
57 stars 25 forks source link

How do I prevent hot-update.json/js files from crowding my project directory #5

Closed ironwren closed 8 years ago

ironwren commented 8 years ago

image

webpack config

var ExtractTextPlugin = require('extract-text-webpack-plugin');
var path = require('path');
var webpack = require('webpack');

var sassLoaders = [
  'css-loader',
  'autoprefixer-loader?browsers=last 2 version',
  'sass-loader?includePathes[]=' + path.resolve(__dirname, "./frontend/sass")
];

module.exports = {
  devtool: 'cheap-module-eval-source-map',
  entry: [
    'webpack-hot-middleware/client',
    './frontend/js/entry.cjsx'
  ],
  output: {
    path: __dirname,
    filename: 'public/js/[name].js'
  },
  module: {
    loaders: [
     { test: /\.css$/, loaders: ['style', 'css']},
     { test: /\.cjsx$/, loaders: ['react-hot', 'coffee', 'cjsx']},
     { test: /\.coffee$/, loader: 'coffee' },
     { test: /\.scss$/, loader: ExtractTextPlugin.extract('style-loader', sassLoaders.join('!'))}
    ]
  },
  plugins: [
    new ExtractTextPlugin('public/css/[name].css'),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  hot: { },
  resolve: {
    extensions: ['','.js','.sass'],
    modulesDirectories: ['node_modules']
  }
};

server.coffee

WebpackPlugin = require 'hapi-webpack-plugin'
Webpack = require 'webpack'
webpackConfig = require('../webpack.config.js')
...
server.register
  register: WebpackPlugin
  options:
    compiler: new Webpack(webpackConfig)
    assets: {}
    hot: {}
, ->
SimonDegraeve commented 8 years ago

This plugin should not create any files. Just like the "official" webpack-dev-server, all files are created in an in-memory filesystem.

Please check again your configuration, in the meantime, I will bump the dependencies of this plugin and make sure it works with the latest webpack-dev-middleware and webpack-hot-middleware.