i18n-auto-react
Version:
基于百度翻译API服务的自动翻译插件
25 lines (22 loc) • 720 B
JavaScript
import { d as getConfiguration } from '../utils/index.js';
import { i as i18nPlugin } from '../utils/parser.js';
//@ts-nocheck
let options = null;
function webpackLoader (source, map, meta) {
let resourcePath = this.resourcePath;
if (!/node_modules/.test(resourcePath)) {
if (!options)
options = getConfiguration() || {};
let res = i18nPlugin(source, {
...options,
filePath: resourcePath,
emitWarning: this.emitWarning
});
if (res && res.code) {
this.callback(null, res.code, map || res.map, meta);
return;
}
}
this.callback(null, source, map, meta);
}
export { webpackLoader as default };