From 462ba0cd26b5de41392e879c45b2fc54b32b7d25 Mon Sep 17 00:00:00 2001 From: Etienne Lemay Date: Wed, 30 Nov 2016 20:59:56 -0500 Subject: [PATCH] Use dynamic version of emoji-datasource for the default sheet URL --- example/webpack.config.js | 8 ++++++++ src/components/emoji.js | 2 +- src/webpack.config.js | 9 ++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/example/webpack.config.js b/example/webpack.config.js index d8de575..1e9012d 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js @@ -1,4 +1,6 @@ var path = require('path') +var pack = require('../package.json') +var webpack = require('webpack') module.exports = { entry: path.resolve('example/index.js'), @@ -31,4 +33,10 @@ module.exports = { resolve: { extensions: ['', '.js'], }, + + plugins: [ + new webpack.DefinePlugin({ + EMOJI_DATASOURCE_VERSION: `'${pack.devDependencies['emoji-datasource']}'`, + }), + ], } diff --git a/src/components/emoji.js b/src/components/emoji.js index 43eef11..b31ce37 100644 --- a/src/components/emoji.js +++ b/src/components/emoji.js @@ -113,8 +113,8 @@ Emoji.defaultProps = { set: 'apple', sheetSize: 64, native: false, + backgroundImageFn: ((set, sheetSize) => `https://unpkg.com/emoji-datasource@${EMOJI_DATASOURCE_VERSION}/sheet_${set}_${sheetSize}.png`), onOver: (() => {}), - backgroundImageFn: ((set, sheetSize) => `https://unpkg.com/emoji-datasource@2.4.4/sheet_${set}_${sheetSize}.png`), onLeave: (() => {}), onClick: (() => {}), } diff --git a/src/webpack.config.js b/src/webpack.config.js index c35f989..a1e6972 100644 --- a/src/webpack.config.js +++ b/src/webpack.config.js @@ -1,4 +1,6 @@ var path = require('path') +var pack = require('../package.json') +var webpack = require('webpack') module.exports = { entry: path.resolve('src/index.js'), @@ -42,6 +44,11 @@ module.exports = { extensions: ['', '.js'], }, - plugins: [], + plugins: [ + new webpack.DefinePlugin({ + EMOJI_DATASOURCE_VERSION: `'${pack.devDependencies['emoji-datasource']}'`, + }), + ], + bail: true, }