Skip to content

Commit

Permalink
try it with a .cjs resolver script
Browse files Browse the repository at this point in the history
  • Loading branch information
oyamauchi committed Nov 15, 2023
1 parent 0cb4554 commit 4b61eb2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .parcelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["@parcel/config-default"],
"resolvers": ["./scripts/parcel-resolver-locales.mjs", "..."],
"resolvers": ["./scripts/parcel-resolver-locales.cjs", "..."],
"reporters": ["...", "parcel-reporter-static-files-copy"]
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Build products
build
dist
generated
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Resolver } from '@parcel/plugin';
import { exec } from 'child_process';
import * as path from 'path';
import * as fs from 'fs';
import { promisify } from 'util';
const { Resolver } = require('@parcel/plugin');
const { exec } = require('child_process');
const path = require('path');
const fs = require('fs');
const { promisify } = require('util');

async function allXlfFiles(projectRoot) {
const entries = await promisify(fs.readdir)(
Expand All @@ -18,7 +18,7 @@ async function allXlfFiles(projectRoot) {
* NB: this is not a Typescript file! (Parcel doesn't support plugins written
* in TS.) No type checking!
*/
export default new Resolver({
module.exports = new Resolver({
async resolve({ specifier, options: { projectRoot } }) {
if (specifier.startsWith('locales:')) {
await promisify(exec)('npx lit-localize build');
Expand Down

0 comments on commit 4b61eb2

Please sign in to comment.