mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
fix the build on windows (#1148)
- make-react importPath variable - esbuild entryPoints globby usage requires forward slashes
This commit is contained in:
@@ -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]',
|
||||
|
||||
@@ -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-')) || [];
|
||||
|
||||
Reference in New Issue
Block a user