1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-15 23:28:20 +09:00
cherrypick/webpack/module/rules/base64.ts

21 lines
359 B
TypeScript
Raw Normal View History

/**
* Replace base64 symbols
*/
import * as fs from 'fs';
export default () => ({
enforce: 'pre',
2018-02-13 13:18:03 +09:00
test: /\.(vue|js)$/,
exclude: /node_modules/,
2018-02-15 19:59:07 +09:00
use: [{
loader: 'replace-string-loader',
options: {
search: /%base64:(.+?)%/g,
replace: (_, key) => {
return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64');
}
2018-02-15 19:59:07 +09:00
}
}]
});