From dc931e260a3d6dc3c7fb39d5706aee29276b0768 Mon Sep 17 00:00:00 2001 From: Mark Davis Date: Thu, 25 Apr 2019 09:32:31 -0400 Subject: [PATCH] fix(configuration): make default config work with yarn PnP This change makes the default values for spriteModule and symbolModule use absolute paths so that they work with yarn plug n play ISSUES CLOSED: 344 --- lib/config.js | 4 ++-- lib/configurator.js | 4 ++-- test/configurator.test.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/config.js b/lib/config.js index 5ef89b5..7f44bc0 100644 --- a/lib/config.js +++ b/lib/config.js @@ -55,7 +55,7 @@ module.exports = { * @type {string} * @autoconfigured */ - spriteModule: 'svg-sprite-loader/runtime/browser-sprite.build', + spriteModule: require.resolve('../runtime/browser-sprite.build'), /** * Path to symbol module. @@ -65,7 +65,7 @@ module.exports = { * @type {string} * @autoconfigured */ - symbolModule: 'svg-baker-runtime/browser-symbol', + symbolModule: require.resolve('svg-baker-runtime/browser-symbol'), /** * Generated export format: diff --git a/lib/configurator.js b/lib/configurator.js index bb41b81..4428805 100644 --- a/lib/configurator.js +++ b/lib/configurator.js @@ -3,8 +3,8 @@ const defaults = require('./config'); const utils = require('./utils'); const loaderDefaults = defaults.loader; -const isomorphicSpriteModule = 'svg-sprite-loader/runtime/sprite.build'; -const isomorphicSymbolModule = 'svg-baker-runtime/symbol'; +const isomorphicSpriteModule = require.resolve('../runtime/sprite.build'); +const isomorphicSymbolModule = require.resolve('svg-baker-runtime/symbol'); const isTargetBrowser = target => target === 'web' || target === 'electron-renderer'; diff --git a/test/configurator.test.js b/test/configurator.test.js index ca876f8..219391f 100644 --- a/test/configurator.test.js +++ b/test/configurator.test.js @@ -38,8 +38,8 @@ describe('configurator', () => { strictEqual(config.symbolModule, loaderDefaults.symbolModule); config = configure({ context, target: 'node' }); - strictEqual(config.spriteModule, 'svg-sprite-loader/runtime/sprite.build'); - strictEqual(config.symbolModule, 'svg-baker-runtime/symbol'); + strictEqual(config.spriteModule, require.resolve('../runtime/sprite.build')); + strictEqual(config.symbolModule, require.resolve('svg-baker-runtime/symbol')); }); it('should properly autodetect extract mode', () => {