-
Notifications
You must be signed in to change notification settings - Fork 125
Incremental / partial builds not working (Windows 10.1 + HP V2.2.1 + Webpack V1.13.3) #99
Comments
Hey, thanks and I'm glad you like it! 😄 Honestly the config looks okay to me, but from what I've seen in the past of this "hangs and doesn't rebuild" symptom is that the plugins never marked themselves as finished. Does it work when you do not engage watch mode? Does the process exit? Also, two things I've no experience with are the plugins you're using; ContextReplacement and Ignore. Try disabling each at a time and see it if yields different results. Let's narrow this down! |
Here is the full config - I have disabled all other plugins. Behavior:When HappyPack is disabled ( Error: \node_modules\webpack-dev-middleware\middleware.js:36
compiler.plugin("done", function(stats) {
^
TypeError: compiler.plugin is not a function
at module.exports (\node_modules\webpack-dev-middleware\middleware.js:36:11) I'm not particularly familiar with webpack - is it normal for it to watch the files even if Config:webpack.config.base.js: import path from 'path';
import webpack from 'webpack';
import HappyPack from 'happypack';
const config = {
iconPath: 'node_modules/react-icons',
enableHappy: false
};
const getHappyConfig = (enable) => {
const config = {};
config.loaders = enable
? [{
test: /\.jsx?$/,
loader: 'happypack/loader?id=babel',
exclude: /node_modules/,
},{
test: /(\.js|\.jsx)$/,
loader: 'happypack/loader?id=babel',
include: [path.resolve(__dirname, './app/node_modules/react-icons/md')],
}]
: [{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/,
},{
test: /(\.js|\.jsx)$/,
loader: 'babel',
include: [path.resolve(__dirname, './app/node_modules/react-icons/md')],
}];
config.plugins = enable
? [new HappyPack({ threads: 4, id: 'babel', loaders: ['babel']})]
: [];
return config;
}
const happyConfig = getHappyConfig(config.enableHappy);
export default {
module: {
loaders: [
...happyConfig.loaders,
{
test: /\.json$/,
loader: 'json-loader',
},{
test: /\.(png|jpg|svg)$/,
loader: 'url-loader?limit=8192'
}],
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name]/index.js',
libraryTarget: 'commonjs2',
},
resolve: {
root: [
path.resolve('./')
],
extensions: ['', '.js', '.jsx'],
packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'],
},
plugins: [
...happyConfig.plugins,
],
externals: [{}],
}; webpack.config.development.js (this extends the base config): /* eslint max-len: 0 */
import webpack from 'webpack';
import baseConfig from './webpack.config.base';
const config = {
...baseConfig,
watch: false,
debug: true,
devtool: 'cheap-module-eval-source-map',
entry: {
main: [
'babel-polyfill',
'webpack-hot-middleware/client?path=http://localhost:3001/__webpack_hmr',
'./app/renderer/main/index',
],
menubar: [
'babel-polyfill',
'webpack-hot-middleware/client?path=http://localhost:3001/__webpack_hmr',
'./app/renderer/menubar/index',
],
preview: [
'babel-polyfill',
'webpack-hot-middleware/client?path=http://localhost:3001/__webpack_hmr',
'./app/renderer/preview/index',
],
},
output: {
...baseConfig.output,
publicPath: 'http://localhost:3001/dist/',
},
module: {
...baseConfig.module,
loaders: [
...baseConfig.module.loaders,
],
},
plugins: [
...baseConfig.plugins,
],
target: 'electron-renderer',
};
export default config; Server.js (this is what actually runs webpack): /* eslint no-console: 0 */
import express from 'express';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
import fs from 'fs';
import config from './webpack.config.development';
const app = express();
const compiler = webpack(config, (err, stats) => {
/*******************************************
Write the stats.json for analysis using:
- http://webpack.github.io/analyse/
- https://alexkuz.github.io/webpack-chart/
- https://chrisbateman.github.io/webpack-visualizer/
********************************************/
// fs.writeFileSync('./stats.json', JSON.stringify(stats.toJson()));
});
const PORT = 3001;
app.use(webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
stats: {
colors: true
}
}));
//app.use(webpackHotMiddleware(compiler));
//app.listen(PORT, 'localhost', err => {
// if (err) {
// return;
// }
//
// console.log(`Listening at http://localhost:${PORT}`);
//}); |
I've run into an issue that might be related: with Tested the latest version of HappyPack under both Webpack 1.12.13 and 1.13.3, on macOS Sierra. |
Confirming that this is an issue on Windows 7 Enterprise as well. However, I am unable to reproduce it on my Ubuntu box. |
Just wanted to mention that I'm on Windows 10 as well, and happypack works fine for me, for both the initial compile and recompiles (ie. incremental compiles). Windows version: 10.0.14393 Build 14393 I don't have time to trim it down (sorry!), but this is my webpack config: ( config.js
webpack.config.js
I know the file above is a mess and a monstrosity. 😆 I have an excuse though, which is that it's based on a yoeman-generator project, and I've not yet gotten around to understanding/modifying the webpack config file it started with. (I'm updating it to my specific project incrementally) |
This should be fixed in |
Official release Thanks to everyone for troubleshooting. |
Initial builds works perfectly and is super fast: 10s down form 50s 🎉🎉🎉
Webpack watch seems to be broken however. When I make changes to files, webpack does not seem to get notified and therefore incremental builds do not happen. When I disable happypack it works fine.
Webpack config (this is just the base config but should be a good representation). When
config.enableHappy
is true, incremental builds break - otherwise it works:Any idea what the issue could be?
Awesome package by the way - the peformance increase on initial build is pretty incredible.
The text was updated successfully, but these errors were encountered: