fixes for testing

This commit is contained in:
ChaosExAnima 2025-04-22 11:55:32 +02:00
parent ba41556bfc
commit 6ac26c81f4
No known key found for this signature in database
GPG Key ID: 8F2B333100FB6117
7 changed files with 10 additions and 12 deletions

4
.gitignore vendored
View File

@ -21,6 +21,7 @@
/public/system
/public/assets
/public/packs
/public/packs-dev
/public/packs-test
.env
.env.production
@ -74,6 +75,3 @@ docker-compose.override.yml
# Ignore local-only rspec configuration
.rspec-local
# Vite Ruby output
/public/vite*

View File

@ -272,7 +272,7 @@ async function mountReactComponent(element: Element) {
);
const { default: Component } = (await import(
`@/mastodon/components/admin/${componentName}`
`@/mastodon/components/admin/${componentName}.jsx`
)) as { default: React.ComponentType };
const root = createRoot(element);

View File

@ -3,8 +3,6 @@ import { loadLocale } from 'mastodon/locales';
import main from 'mastodon/main';
import { loadPolyfills } from 'mastodon/polyfills';
import '@/styles/application.scss';
start();
loadPolyfills()

View File

@ -1 +0,0 @@
import '../styles/mailer.scss';

View File

@ -28,7 +28,7 @@ function main() {
if (isProduction() && me && 'serviceWorker' in navigator) {
const { Workbox } = await import('workbox-window');
const wb = new Workbox(
isDevelopment() ? '/vite-dev/dev-sw.js?dev-sw' : '/sw.js',
isDevelopment() ? '/packs-dev/dev-sw.js?dev-sw' : '/sw.js',
{ type: 'module', scope: '/' },
);
let registration;

View File

@ -9,12 +9,12 @@
},
"development": {
"autoBuild": true,
"publicOutputDir": "vite-dev",
"publicOutputDir": "packs-dev",
"port": 3036
},
"test": {
"autoBuild": true,
"publicOutputDir": "vite-test",
"publicOutputDir": "packs-test",
"port": 3037
}
}

View File

@ -24,7 +24,7 @@ import { MastodonServiceWorkerLocales } from './config/vite/plugin-sw-locales';
const jsRoot = path.resolve(__dirname, 'app/javascript');
const entrypointRoot = path.resolve(jsRoot, 'entrypoints');
const config: UserConfigFnPromise = async ({ mode }) => {
const config: UserConfigFnPromise = async ({ mode, command }) => {
const entrypointFiles = await fs.readdir(entrypointRoot);
const entrypoints: Record<string, string> = entrypointFiles.reduce(
(acc, file) => {
@ -69,6 +69,7 @@ const config: UserConfigFnPromise = async ({ mode }) => {
outDir: path.resolve(__dirname, '.dist'),
emptyOutDir: true,
manifest: 'manifest.json',
sourcemap: true,
rollupOptions: {
input: entrypoints,
output: {
@ -110,7 +111,9 @@ const config: UserConfigFnPromise = async ({ mode }) => {
},
},
plugins: [
RailsPlugin(),
RailsPlugin({
compress: mode !== 'production' && command === 'build',
}),
react(),
MastodonServiceWorkerLocales(),
VitePWA({