mirror of
https://github.com/scratchfoundation/scratch-storage.git
synced 2025-07-06 03:20:33 -04:00
Injecting the path into the "code" was causing the backslashes to be interpreted as escape characters instead of path separators. I could have escaped them, but this approach is more similar to what Webpack does with `arraybuffer-loader` and (IMO) easier to read.
11 lines
281 B
JavaScript
11 lines
281 B
JavaScript
const fs = require('fs');
|
|
|
|
module.exports = {
|
|
process (_sourceText, sourcePath) {
|
|
const buffer = fs.readFileSync(sourcePath);
|
|
const array = buffer.toJSON().data;
|
|
return {
|
|
code: `module.exports = Buffer.from([${array}]);`
|
|
};
|
|
}
|
|
};
|