Skip to content

Commit b30c4aa

Browse files
authored
Fix static file serving for publicPath != / (fix#1176) (#1180)
* Batman! * fix typo
1 parent 3f232bf commit b30c4aa

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

template/build/webpack.dev.conf.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const utils = require('./utils')
33
const webpack = require('webpack')
44
const config = require('../config')
55
const merge = require('webpack-merge')
6+
const path = require('path')
67
const baseWebpackConfig = require('./webpack.base.conf')
8+
const CopyWebpackPlugin = require('copy-webpack-plugin')
79
const HtmlWebpackPlugin = require('html-webpack-plugin')
810
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
911
const portfinder = require('portfinder')
@@ -23,6 +25,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
2325
clientLogLevel: 'warning',
2426
historyApiFallback: true,
2527
hot: true,
28+
contentBase: false, // since we use CopyWebpackPlugin.
2629
compress: true,
2730
host: HOST || config.dev.host,
2831
port: PORT || config.dev.port,
@@ -50,6 +53,14 @@ const devWebpackConfig = merge(baseWebpackConfig, {
5053
template: 'index.html',
5154
inject: true
5255
}),
56+
// copy custom static assets
57+
new CopyWebpackPlugin([
58+
{
59+
from: path.resolve(__dirname, '../static'),
60+
to: config.dev.assetsSubDirectory,
61+
ignore: ['.*']
62+
}
63+
])
5364
]
5465
})
5566

0 commit comments

Comments
 (0)