React 的电子无法加载自定义光标
Electron for React cannot load custom cursor
我在 React 中使用 Electron。我遇到一个问题,Electron 无法获取我的自定义光标,但它适用于默认光标,如指针、进度等。这是我的 CSS 属性 光标值:
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..)
]
};
有人知道我的问题的解决方案吗?
尝试将此加载程序添加到您的 webpack 配置文件以测试 .png 支持:
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
我在 React 中使用 Electron。我遇到一个问题,Electron 无法获取我的自定义光标,但它适用于默认光标,如指针、进度等。这是我的 CSS 属性 光标值:
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..)
]
};
有人知道我的问题的解决方案吗?
尝试将此加载程序添加到您的 webpack 配置文件以测试 .png 支持:
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }