Problem: When running my react application locally with "npm run" I get a white page with no error logs.
Frameworks/programs used
- React 15.6.2
- NodeJs 8.11.3
- webpack 1.15.0
- babel 6.26.0
- Git 2.18
OS Windows 10
I tried deleting all the node modules and the package-lock.json, I also tried updating the version of webpack as sugested here Whitescreen of death after pulling from git repo (ReactJS, Nginx)
One thing I noticed is that while I don't see any thing been loaded if I change a component I get the message: "The following modules couldn't be hot updated: (full reload needed)"
I tried updating the hot loader but this didn't work either, does anyone have an idea of whats going on?
UPDATE Here is the webpack sever configuration:
const webpack = require('webpack');
const path = require('path');
const webpackAliases = require('./webpackAliases');
const localBasePath = path.resolve(__dirname, '../');
const { localModuleResolve, localRootResolve, resolve } = require('../../common/tools');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const {
babelLoader,
jsonLoader,
urlLoader,
svgReactLoader,
extractStylesLoader,
faviconLoader,
declarityLoader,
workerLoader
} = require('./webpackLoaders');
module.exports = (basePath, appEntry, devConfig) => {
const routesEntry = devConfig.app.routes;
const historyAlias = {
'deps-history': typeof devConfig.devServer.history == 'string'
? devConfig.devServer.history
: localRootResolve('common/defaultHistory')
}
const extraWebpackConfig = devConfig.webpack || {};
const extraAliases = extraWebpackConfig.aliases || {};
return {
entry: [
'babel-polyfill',
resolve('react-hot-loader/patch'),
resolve('webpack-hot-middleware/client'),
localRootResolve('src/devEntry.js')
],
output : {
filename: '[name].js',
path: extraWebpackConfig.destinationPath || path.resolve(basePath, 'lib'),
publicPath: '/static/'
},
devtool: 'cheap-module-source-map',
module: {
rules: [
babelLoader({
use: {
options: {
plugins: require("react-hot-loader/babel")
}
},
include: [
localRootResolve('src'),
localRootResolve('lib'),
path.join(basePath, 'src')
],
}),
jsonLoader(),
urlLoader(),
svgReactLoader(),
faviconLoader(),
declarityLoader(),
workerLoader()
// extractStylesLoader()
]
},
resolve: {
alias: Object.assign(
{},
webpackAliases,
extraAliases,
historyAlias,
routesEntry ? {'deps-routes': path.resolve(basePath, routesEntry)} : {}
),
extensions: [".js", ".jsx", ".json", ".dsx"],
modules: [path.resolve(basePath, 'node_modules'), path.resolve(__dirname, '../../', 'node_modules')]
},
externals: {
'react/addons': 'react',
'react/lib/ExecutionEnvironment': 'react',
'react/lib/ReactContext': 'react',
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.EnvironmentPlugin(['NODE_ENV', 'WORKING_DIR']),
//new ExtractTextPlugin({ filename: '[name]-styles.css', allChunks: true }),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
minChunks: function (module) {
// this assumes your vendor imports exist in the node_modules directory
return module.context && module.context.indexOf("node_modules") !== -1;
}
}),
]
}
};