Allow to customize base resources root for rendered text images

This commit is contained in:
ErickSkrauch 2019-06-01 22:24:01 +03:00
parent 437d746651
commit 978e02eb22

View File

@ -14,7 +14,6 @@ module.exports = async function(content) {
const callback = this.async(); const callback = this.async();
const { publicPath } = this._compiler.options.output;
const ROOT_PATH = path.join(this.rootContext, 'src'); const ROOT_PATH = path.join(this.rootContext, 'src');
const localeName = path.basename(this.resourcePath, `.${this.resourcePath.split('.').pop()}`); const localeName = path.basename(this.resourcePath, `.${this.resourcePath.split('.').pop()}`);
@ -40,7 +39,7 @@ module.exports = async function(content) {
return; return;
} }
global.__webpack_public_path__ = publicPath; // eslint-disable-line camelcase global.__webpack_public_path__ = ''; // eslint-disable-line camelcase
const { src, width, height } = this.exec(module, fileName); const { src, width, height } = this.exec(module, fileName);
Reflect.deleteProperty(global, '__webpack_public_path__'); Reflect.deleteProperty(global, '__webpack_public_path__');
@ -111,7 +110,7 @@ module.exports = async function(content) {
translations[key] = await examine(key, json[key]); translations[key] = await examine(key, json[key]);
return translations; return translations;
}, Promise.resolve({}))); }, Promise.resolve({}))).replace(/(<img src=\\")(assets)/g, '$1" + __webpack_public_path__ + "$2');
callback(null, ` callback(null, `
import { defineMessages } from 'react-intl'; import { defineMessages } from 'react-intl';