fix sw build
This commit is contained in:
parent
5bd0228da2
commit
7e9b3441eb
|
@ -51,7 +51,7 @@ const primaries = {
|
||||||
// 何故か文字列にバックスペース文字が混入することがあり、YAMLが壊れるので取り除く
|
// 何故か文字列にバックスペース文字が混入することがあり、YAMLが壊れるので取り除く
|
||||||
const clean = (text) => text.replace(new RegExp(String.fromCodePoint(0x08), 'g'), '');
|
const clean = (text) => text.replace(new RegExp(String.fromCodePoint(0x08), 'g'), '');
|
||||||
|
|
||||||
const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(`${__dirname}/${c}.yml`, 'utf-8'))) || {}, a), {});
|
const locales = languages.reduce((a, c) => (a[c] = yaml.load(clean(fs.readFileSync(new URL(`${c}.yml`, import.meta.url), 'utf-8'))) || {}, a), {});
|
||||||
|
|
||||||
export default Object.entries(locales)
|
export default Object.entries(locales)
|
||||||
.reduce((a, [k ,v]) => (a[k] = (() => {
|
.reduce((a, [k ,v]) => (a[k] = (() => {
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
const esbuild = require('esbuild');
|
import * as esbuild from 'esbuild';
|
||||||
const locales = require('../../locales');
|
import locales from '../../locales/index.js';
|
||||||
const meta = require('../../package.json');
|
import meta from '../../package.json' assert { type: "json" };
|
||||||
|
import { fileURLToPath } from 'node:url';
|
||||||
const watch = process.argv[2]?.includes('watch');
|
const watch = process.argv[2]?.includes('watch');
|
||||||
|
|
||||||
|
const __dirname = fileURLToPath(new URL(".", import.meta.url))
|
||||||
|
|
||||||
console.log('Starting SW building...');
|
console.log('Starting SW building...');
|
||||||
|
|
||||||
/** @type {esbuild.BuildOptions} */
|
/** @type {esbuild.BuildOptions} */
|
||||||
|
|
|
@ -19,5 +19,6 @@
|
||||||
"eslint": "8.44.0",
|
"eslint": "8.44.0",
|
||||||
"eslint-plugin-import": "2.27.5",
|
"eslint-plugin-import": "2.27.5",
|
||||||
"typescript": "5.1.6"
|
"typescript": "5.1.6"
|
||||||
}
|
},
|
||||||
|
"type": "module"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue