使用Webpack开发服务器提供图像
我怎样才能像静态文件一样提供图像服务,而不是内联图像,也不导入图像 通过我的配置,我可以像往常一样在css中使用图像。我需要导入/要求每个图像才能工作。我只想通过使用Webpack开发服务器提供图像,webpack,webpack-dev-server,Webpack,Webpack Dev Server,我怎样才能像静态文件一样提供图像服务,而不是内联图像,也不导入图像 通过我的配置,我可以像往常一样在css中使用图像。我需要导入/要求每个图像才能工作。我只想通过webpack dev server提供/images中的图像 我有以下配置: module.exports = { entry: [ 'react-hot-loader/patch', './src/index.jsx', // your app's entry point ], devtool: proc
webpack dev server
提供/images
中的图像
我有以下配置:
module.exports = {
entry: [
'react-hot-loader/patch',
'./src/index.jsx', // your app's entry point
],
devtool: process.env.WEBPACK_DEVTOOL || 'source-map, eval-source-map',
output: {
publicPath: '/',
path: path.join(__dirname, 'public'),
filename: 'bundle.js'
},
resolve: {
extensions: ['.js', '.jsx']
},
module: {
loaders
},
devServer: {
contentBase: "./public",
// do not print bundle build stats
noInfo: true,
// enable HMR
hot: true,
// embed the webpack-dev-server runtime into the bundle
inline: true,
// serve index.html in place of 404 responses to allow HTML5 history
historyApiFallback: true,
port: PORT,
host: HOST
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin({
filename: 'style.css',
allChunks: true
}),
new DashboardPlugin(),
new HtmlWebpackPlugin({
template: './src/template.html',
files: {
css: ['style.css'],
js: [ "bundle.js"],
}
}),
]
};
看那个看那个