Blank page - bundle not executed.
See original GitHub issue- Operating System: MacOS 10.13.4
- Node Version: 8.11.3
- NPM Version: 6.2
- webpack Version: 4.12.2
- webpack-cli: 3.0.8
- webpack-dev-server Version: 3.1.14
- This is a bug
- This is a modification request
Code
webpack.config.js
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: path.resolve(__dirname, '../src'),
entry: './index.tsx',
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, '../dist'),
},
devServer: {
hot: true,
open: true,
port: 9000,
inline: true,
},
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', 'jsx'],
},
module: {
rules: [
{
test: /\.(tsx|ts)$/,
exclude: /node_modules/,
loader: 'ts-loader',
}
]
},
plugins: [
new HtmlWebpackPlugin()
]
}
index.tsx
console.log('test')
package.json
"start": "webpack-dev-server --config ./webpack/webpack.config.js"
Expected Behavior
Serve blank application that logs ‘test’ in console. I’d like to display react application, but it seems website served by webpack-dev-server never executes bundle code.
Actual Behavior
Blank page, no log.
If I add publicPath
to output
webpack-dev-server displays only already bundled content from dist, no HMR.
Application works if bundled with webpack and run manually.
I tried few configuration with contentBase
and watchContentBase
but always:
- if there is HMR log in console there is no bundle code executed
- if there is no HMR log webpack-dev-server doesn’t bundle anything only serves already builded static files
For Bugs; How can we reproduce the behavior?
Webpack configuration.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
Refresh page on react-router outputs blank page, bundle.js is ...
I checked the console after the page is refreshed, and there is no bundle.js loaded, only index.html is loaded - which explains the...
Read more >Blank page when Webpack React deploys - No bundle.js in ...
I'm trying to deploy a basic application with React and Webpack, but only a blank page is displayed. I can see in the...
Read more >Learn Build Tools: Rock, Paper, Bundle Project extra ...
Basically, I completed the entire project but it would not open properly in the browser when I ran 'npm run start'
Read more >Troubleshooting Session Manager - AWS Documentation
Managed node not available or not configured for Session Manager ... Problem: You start a session and Session Manager displays a blank screen....
Read more >When using react.js webpack-dev-server does not bundle
When you run the app, there is an embedded web server that runs our project, when we edit a file like App.js, the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I was having this exact same issue and realized that I was using
optimization.splitChunks
in my default webpack config but wasn’t linking to the common (chunked) script on my entry page. Hopefully this helps someone else.This issue for me was a result of the template for
HtmlWebpackPlugin
having the same path/name as the generatedindex.html
. On file changes the the bundles were rebuilt but the original template file was served (with no script tags) instead of the generated file.The fix was a simple changing of the template filename & updating the name in the
HtmlWebpackPlugin
plugin config to this new name.