Skip to content
Snippets Groups Projects
Commit 085ac938 authored by syuilo's avatar syuilo
Browse files

wip

parent a7601f7a
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,7 @@
"is-url": "1.2.2",
"js-yaml": "3.10.0",
"license-checker": "16.0.0",
"loader-utils": "^1.1.0",
"mecab-async": "0.1.2",
"mkdirp": "0.5.1",
"mocha": "5.0.0",
......
const loaderUtils = require('loader-utils');
function trim(text) {
return text.substring(1, text.length - 2);
}
module.exports = function(src) {
this.cacheable();
const options = loaderUtils.getOptions(this);
if (typeof options.search != 'string' || options.search.length == 0) console.error('invalid search');
if (typeof options.replace != 'function') console.error('invalid replacer');
src = src.replace(new RegExp(trim(options.search), 'g'), options.replace);
this.callback(null, src);
return src;
};
......@@ -5,12 +5,12 @@
import { pattern, replacement } from '../../../src/common/build/fa';
export default () => ({
enforce: 'pre',
//enforce: 'pre',
test: /\.(vue|js|ts)$/,
exclude: /node_modules/,
loader: 'string-replace-loader',
loader: 'replace',
query: {
search: pattern,
search: pattern.toString(),
replace: replacement
}
});
......@@ -8,12 +8,12 @@ export default lang => {
const replacer = new Replacer(lang);
return {
enforce: 'pre',
//enforce: 'post',
test: /\.(vue|js|ts)$/,
exclude: /node_modules/,
loader: 'string-replace-loader',
loader: 'replace',
query: {
search: replacer.pattern,
search: replacer.pattern.toString(),
replace: replacer.replacement
}
};
......
......@@ -8,10 +8,11 @@ import collapseSpaces from './collapse-spaces';
export default lang => [
//collapseSpaces(),
//i18n(lang),
//fa(),
//base64(),
vue(),
i18n(lang),
fa(),
stylus(),
typescript()
];
......@@ -40,6 +40,9 @@ module.exports = Object.keys(langs).map(lang => {
'.js', '.ts'
]
},
resolveLoader: {
modules: ['node_modules', './webpack/loaders']
},
cache: true,
devtool: 'eval',
stats: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment