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