2017-10-21 22:11:28 -07:00
|
|
|
/**
|
|
|
|
* Replace base64 symbols
|
|
|
|
*/
|
|
|
|
|
|
|
|
import * as fs from 'fs';
|
|
|
|
const StringReplacePlugin = require('string-replace-webpack-plugin');
|
|
|
|
|
|
|
|
export default () => ({
|
|
|
|
enforce: 'pre',
|
2018-02-12 20:18:03 -08:00
|
|
|
test: /\.(vue|js)$/,
|
2017-10-21 22:11:28 -07:00
|
|
|
exclude: /node_modules/,
|
|
|
|
loader: StringReplacePlugin.replace({
|
|
|
|
replacements: [{
|
|
|
|
pattern: /%base64:(.+?)%/g, replacement: (_, key) => {
|
|
|
|
return fs.readFileSync(__dirname + '/../../../src/web/' + key, 'base64');
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
})
|
|
|
|
});
|