Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: set "type": "module" #78

Merged
merged 4 commits into from
Jul 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@hiogawa/vite-plugins-monorepo",
"private": true,
"type": "module",
"scripts": {
"build": "pnpm -r build",
"dev": "run-p dev:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/demo/misc/vercel/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set -eu -o pipefail
# functions/
# index.func/
# .vc-config.json
# index.js = dist/server/index.mjs (bundled)
# index.js = bundled dist/server/index.js or mjs

# clean
rm -rf .vercel/output
Expand All @@ -27,5 +27,5 @@ cp -r dist/client/assets .vercel/output/static/assets

# serverless
mkdir -p .vercel/output/functions/index.func
npx esbuild dist/server/index.mjs --outfile=.vercel/output/functions/index.func/index.js --bundle --minify --format=esm --platform=browser --metafile=dist/server/esbuild-metafile.json
npx esbuild dist/server/index.js --outfile=.vercel/output/functions/index.func/index.js --bundle --minify --format=esm --platform=browser --metafile=dist/server/esbuild-metafile.json
cp misc/vercel/.vc-config.json .vercel/output/functions/index.func/.vc-config.json
1 change: 1 addition & 0 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@hiogawa/vite-plugins-demo",
"private": true,
"type": "module",
"scripts": {
"dev": "run-p dev:*",
"dev:vite": "vite",
Expand Down
6 changes: 1 addition & 5 deletions packages/demo/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import process from "node:process";
import { defineConfig } from "@playwright/test";

const PORT = Number(process.env["PORT"] ?? "4456");
const PORT = Number((process.env.PORT ??= "4456"));
const command = process.env["E2E_COMMAND"] ?? `pnpm dev:vite`;

export default defineConfig({
Expand All @@ -26,10 +26,6 @@ export default defineConfig({
webServer: {
command: command + ` >> dev-e2e.log 2>&1`,
port: PORT,
env: {
...(process.env as any),
PORT,
},
Comment on lines -29 to -32
Copy link
Owner Author

@hi-ogawa hi-ogawa Jul 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this way of passing process.env is causing --experimental-loader to be also included, which breaks server command:

Anyway, we should only need PORT, so we can just overwrite it like process.env.PORT ??= "4456" above.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a bit more annoying since, for example, this --experimental-loader also injected when running child_process.exec inside playwright e2e.

reuseExistingServer: true,
},
forbidOnly: Boolean(process.env["CI"]),
Expand Down