1 | const Asset = require('../Asset');
|
2 | const urlJoin = require('../utils/urlJoin');
|
3 | const md5 = require('../utils/md5');
|
4 |
|
5 | class RawAsset extends Asset {
|
6 |
|
7 | load() {}
|
8 |
|
9 | generate() {
|
10 |
|
11 |
|
12 | if (this.options.bundleLoaders[this.type]) {
|
13 | return {};
|
14 | }
|
15 |
|
16 | const pathToAsset = urlJoin(
|
17 | this.options.publicURL,
|
18 | this.generateBundleName()
|
19 | );
|
20 |
|
21 | return [
|
22 | {
|
23 | type: 'js',
|
24 | value: `module.exports=${JSON.stringify(pathToAsset)};`
|
25 | }
|
26 | ];
|
27 | }
|
28 |
|
29 | async generateHash() {
|
30 | return md5.file(this.name);
|
31 | }
|
32 | }
|
33 |
|
34 | module.exports = RawAsset;
|