我如何像静态文件一样提供我的图像,而不是内联它们,而不是导入它们?
使用我的配置,我可以像往常一样使用css中的图像。在html(jsx)中的位我需要导入/要求每个图像都能正常工作。我希望只使用webpack-dev-server
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"],
}
}),
]
};
来提供我的图像。
我有以下配置:
tslint