forked from external-repos/squoosh
Add Babel to fix Node <14 compat
This commit is contained in:
12
cli/lib/autojson-plugin.js
Normal file
12
cli/lib/autojson-plugin.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { promises as fsp } from 'fs';
|
||||
|
||||
export default function autojsonPlugin() {
|
||||
return {
|
||||
name: 'autojson-plugin',
|
||||
async load(id) {
|
||||
if (id.endsWith('.json') && !id.startsWith('json:')) {
|
||||
return 'export default ' + await fsp.readFile(id, 'utf8');
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user