Closed Infonautica closed 7 years ago
add 'build' scripts config in package.json ,then run 'npm run build'
scripts:{
"build":"webpack --progress --profile --colors"
}
I'm having the exact same issue.
@arixse I feel you didn't quite understand the question. We would like to serve static files with the server during the development process.
The solution is detailed here.
For you adding app.use('/static', express.static('dist'))
somewhere to your server.js file should do the trick. :)
Yep, see above for Express. For WebpackDevServer
, use the contentBase
option
Description
Have a trouble with static files
entry: [ 'webpack-hot-middleware/client', './src/app' ], output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js', publicPath: '/static/' }
React applications is works fine, but without css and other static files. I put them in "dist" folder, but still cant get them, so:
<script src="/static/bundle.js"></script>
// Works fine<link href="/static/css/main.min.css" rel="stylesheet">
// Cant getEnvironment
React Hot Loader version: 1.3.1
node -v
: 4.4.7npm -v
: 3.10.5