fix the build on windows (#1148)

- make-react importPath variable
 - esbuild entryPoints globby usage requires forward slashes
This commit is contained in:
Joe Marquardt
2025-07-14 15:13:11 -05:00
committed by GitHub
parent f5624fbf4a
commit f621fbb224
2 changed files with 5 additions and 5 deletions

View File

@@ -8,7 +8,7 @@ import { replace } from 'esbuild-plugin-replace';
import { mkdir, readFile } from 'fs/promises';
import getPort, { portNumbers } from 'get-port';
import { globby } from 'globby';
import { dirname, join, relative } from 'node:path';
import { dirname, join, posix, relative } from 'node:path';
import process from 'node:process';
import { fileURLToPath } from 'node:url';
import ora from 'ora';
@@ -186,11 +186,11 @@ export async function build(options = {}) {
join(rootDir, 'src/webawesome.loader.ts'),
join(rootDir, 'src/webawesome.ssr-loader.ts'),
// Individual components
...(await globby(join(rootDir, 'src/components/**/!(*.(style|test)).ts'))),
...(await globby(posix.join(rootDir, 'src/components/**/!(*.(style|test)).ts'))),
// Translations
...(await globby(join(rootDir, 'src/translations/**/*.ts'))),
...(await globby(posix.join(rootDir, 'src/translations/**/*.ts'))),
// React wrappers
...(await globby(join(rootDir, 'src/react/**/*.ts'))),
...(await globby(posix.join(rootDir, 'src/react/**/*.ts'))),
],
outdir: getCdnDir(),
chunkNames: 'chunks/[name].[hash]',

View File

@@ -25,7 +25,7 @@ for await (const component of components) {
const tagWithoutPrefix = component.tagName.replace(/^wa-/, '');
const componentDir = path.join(reactDir, tagWithoutPrefix);
const componentFile = path.join(componentDir, 'index.ts');
const importPath = path.relative(srcDir, component.path);
const importPath = path.posix.relative(srcDir, component.path);
// We only want to wrap wa- prefixed events, because the others are native
const eventsToWrap = component.events?.filter(event => event.name.startsWith('wa-')) || [];