2016-12-07 48 views
0

我想要在文件夾/ dist /中擁有jQuery ui資產,並且它們應該從應用程序加載。我有這個在我的WebPack配置:使用文件加載器從webpack中的jQuery UI加載資產

module.exports = { 
    context: path.resolve(__dirname, "app"), 
    output: { 
     path: __dirname + '/dist', 
     filename: 'app.bundle.js' 
    }, 
    module: { 
     loaders: [ 
      { 
       test: /\.css$/, 
       loaders: [ 
        'style-loader', 
        'css-loader?importLoaders=1', 
        'postcss-loader' 
       ] 
      }, 
      { 
       test: /\.(jpe?g|png|gif|svg)$/i, 
       loaders: [ 
        'file?hash=sha512&digest=hex&name=[hash].[ext]', 
        'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false' 
       ] 
      } 
     ] 
    } 
}; 

,並嘗試從根目錄加載的資產,而不是從/dist圖像文件位於dist目錄。

我嘗試DIST添加到名稱:

'file?hash=sha512&digest=hex&name=dist/[hash].[ext]' 

圖像加載,但隨後我有圖像文件目錄dist /,DIST。我嘗試添加./,但圖像未加載。我也嘗試設置outputPath=/dist/但這並沒有改變任何東西。

回答

0

這項工作:

file?hash=sha512&digest=hex&name=[hash].[ext]&publicPath=dist/