1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-15 07:08:56 +09:00
cherrypick/webpack/module/rules/i18n.ts
2018-02-10 17:01:32 +09:00

22 lines
445 B
TypeScript

/**
* Replace i18n texts
*/
const StringReplacePlugin = require('string-replace-webpack-plugin');
import Replacer from '../../../src/common/build/i18n';
export default lang => {
const replacer = new Replacer(lang);
return {
enforce: 'pre',
test: /\.(vue|js|ts)$/,
exclude: /node_modules/,
loader: StringReplacePlugin.replace({
replacements: [{
pattern: replacer.pattern, replacement: replacer.replacement
}]
})
};
};