首页 > webpack 图片无法输出到目录里

webpack 图片无法输出到目录里

我的webpackconfig

var path = require('path');
var webpack = require('webpack');
var $ = require("jquery")

function getPublicPath(sources) {
    if (process.env.NODE_ENV !== 'production') {
        sources='http://localhost:8080' + sources;
    }
    return sources;
}

module.exports = {
  devtool: 'source-map',
  entry: [
    'webpack-dev-server/client?http://localhost:8080',
    'webpack/hot/only-dev-server',
    './src/index'
  ],
  output: {
    path: path.join(__dirname, 'assets'),
    filename: 'bundle.js',
    publicPath: 'http://localhost:8080/static/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery",
        "window.jQuery": "jquery"
    })
  ],
  module: {
    loaders: [{
      test: /\.js$/,
      loaders: ['react-hot', 'babel'],
      include: path.join(__dirname, 'src')
      },{
        test: /\.styl$/,
        loader: 'style-loader!css-loader!stylus-loader'
      },{
        test: /\.(png|jpg|gif|woff|woff2)$/,
        loader: 'url-loader?limit=8192'
      },
      {// 如果要加载jQuery插件,解析路径&参数
              test : path.resolve(__dirname,"src/common/lib/plugins/*.js$"),
              loader : "imports?jQuery=jquery,$=jquery,this=>window"
          }
    ]
  }
};

每次编译完只有 js

Hash: ba03dbf64b475f3c1c90
Version: webpack 1.13.0
Time: 9022ms
        Asset     Size  Chunks             Chunk Names
    bundle.js   952 kB       0  [emitted]  main
bundle.js.map  1.11 MB       0  [emitted]  main
   [0] multi main 52 bytes {0} [built]

我的 entry.js为

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';

ReactDOM.render(<App />, document.getElementById('app'));

app.js

import React, { Component } from 'react';
import LogoImg from './images/logo.png'

const Logo = () => (
  <div className="Logo">
    <a href="/llq">
      <img src={LogoImg} />
    </a>
  </div>
)


export default Logo

图片就是无法输出到assets目录下 求解。。。。

【热门文章】
【热门文章】