2017-09-05 70 views
1

我正在使用React中的Electron。我有一個問題,即電子不能讓我的自定義光標,但它與默認光標指針一樣,進度等效果很好。這是光標我的CSS屬性值:React的電子無法加載自定義光標

cursor: url('../../images/common/icon_cut.png'); 

這是我的錯誤信息:

0] ERROR in ./app/images/common/icon_cut.png
[0] Module parse failed: /Users/cuong/ops/ecode/skill-share/app/images/common/icon_cut.png Unexpected character '�' (1:0)
[0] You may need an appropriate loader to handle this file type. [0] SyntaxError: Unexpected character '�' (1:0)

這是我的WebPack配置

'use strict'; 

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

module.exports = { 
    module: { 
    loaders: [{ 
     test: /\.jsx?$/, 
     loaders: ['babel-loader'], 
     exclude: /node_modules/ 
    }, { 
     test: /\.json$/, 
     loader: 'json-loader' 
    }] 
    }, 
    output: { 
    path: path.join(__dirname, 'dist'), 
    filename: 'bundle.js', 
    libraryTarget: 'commonjs2' 
    }, 
    resolve: { 
    extensions: ['', '.js', '.jsx'], 
    packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'] 
    }, 
    plugins: [ 
    new webpack.optimize.DedupePlugin(), 
    ], 
    externals: [ 
    // put your node 3rd party libraries which can't be built with webpack here 
    // (mysql, mongodb, and so on..) 
    ] 
}; 

有人知道解決我的問題?

+0

請附上您的WebPack配置文件的內容。你可能在那裏有一個錯誤。 – TylerH

+0

可能你的javascript試圖加載PNG –

+0

添加我的webpack配置文件內容 – gintoki27

回答

1

嘗試增加這部分代碼,您的WebPack配置文件來測試巴紐支持:

{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' } 
+0

像一個魅力工作!謝謝。 – gintoki27