Webpack图像加载器在输入图像时不显示任何错误

时间:2016-09-01 00:17:28

标签: webpack loader

我使用answer并希望只输入我在main.js反应组件所在目录中的图像,但它根本没有显示,我没有得到任何错误。我使用webpack,babel,es6,react和redux:

main.js

const Main = () => (
    <div>

      <img src="./pokemon1.png" />
      <SearchableSearchBar />
      <PopulatedProfile />
      <PopulatedTypeHolder />
      <ClickedPokeList />
    </div>
)

webpack config

var path = require('path');
var webpack = require('webpack');

module.exports = {
  devtool: 'source-map',
  entry: [
    'webpack-hot-middleware/client',
    './client/pokeapp'
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  module: {
    loaders: [
      // js
      {
        test: /\.js$/,
        loaders: ['babel'],
        include: path.join(__dirname, 'client')
      },
      // CSS
      {
        test: /\.css$/,
        include: path.join(__dirname, 'client'),
        loader: 'style-loader!css-loader'

      },
      { test: /\.(woff|woff2|eot|ttf|svg)$/,
        loader: 'url'
      },
      {
        test: /\.(jpe?g|png|gif|svg)$/i,
        include: path.join(__dirname, 'client'),
        loaders: [
            'file?hash=sha512&digest=hex&name=[hash].[ext]',
            'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
        ]
      }
    ]
  }
};

0 个答案:

没有答案