Compare commits

...
Author SHA1 Message Date
Sojan 816294e609 chore: fixes 2025-06-03 03:41:49 -05:00
Sojan 9813400237 chore:fixes 2025-06-03 03:33:45 -05:00
Sojan cece07d649 chore: teest 2025-06-03 03:15:15 -05:00
4 changed files with 16 additions and 4 deletions
+3
View File
@@ -0,0 +1,3 @@
backend: DISABLE_MINI_PROFILER=true bin/rails s -p 3000
worker: dotenv bundle exec sidekiq -C config/sidekiq.yml
vite: BUILD_MODE=dev bin/vite build --watch
+1 -1
View File
@@ -1,6 +1,6 @@
# frozen_string_literal: true
if Rails.env.development?
if Rails.env.development? && ENV['DISABLE_MINI_PROFILER'] != 'true'
require 'rack-mini-profiler'
# initialization is skipped so trigger it
+1
View File
@@ -11,6 +11,7 @@
"start:dev": "foreman start -f ./Procfile.dev",
"start:test": "RAILS_ENV=test foreman start -f ./Procfile.test",
"dev": "overmind start -f ./Procfile.dev",
"dev:tunnel": "overmind start -f ./Procfile.tunnel",
"ruby:prettier": "bundle exec rubocop -a",
"build:sdk": "BUILD_MODE=library vite build",
"prepare": "husky install",
+11 -3
View File
@@ -1,7 +1,7 @@
/// <reference types="vitest" />
/**
What's going on with library mode?
What's going on with build modes?
Glad you asked, here's a quick rundown:
@@ -13,8 +13,10 @@ This puts us in a deadlock, now there are two ways around this, either add anoth
the app using vanilla rollup or rspack or something. The second option is to remove sdk building from the main pipeline
and build it separately using Vite itself, toggled by an ENV variable.
`BUILD_MODE=library bin/vite build` should build only the SDK and save it to `public/packs/js/sdk.js`
`bin/vite build` will build the rest of the app as usual. But exclude the SDK.
Build modes:
- `BUILD_MODE=library bin/vite build` should build only the SDK and save it to `public/packs/js/sdk.js`
- `BUILD_MODE=dev bin/vite build --watch` builds with fast dev settings (no minify, inline sourcemaps) for tunnels/codespace
- `bin/vite build` will build the rest of the app as usual. But exclude the SDK.
We need to edit the `asset:precompile` rake task to include the SDK in the precompile list.
*/
@@ -24,6 +26,7 @@ import path from 'path';
import vue from '@vitejs/plugin-vue';
const isLibraryMode = process.env.BUILD_MODE === 'library';
const isDevMode = process.env.BUILD_MODE === 'dev';
const isTestMode = process.env.TEST === 'true';
const vueOptions = {
@@ -45,6 +48,10 @@ if (isLibraryMode) {
export default defineConfig({
plugins: plugins,
build: {
minify: isDevMode ? false : 'esbuild',
cssMinify: isDevMode ? false : true,
sourcemap: isDevMode ? false : false,
target: isDevMode ? 'es2019' : undefined,
rollupOptions: {
output: {
// [NOTE] when not in library mode, no new keys will be addedd or overwritten
@@ -60,6 +67,7 @@ export default defineConfig({
},
}
: {}),
...(isDevMode ? { manualChunks: undefined } : {}), // single bundle for dev mode
inlineDynamicImports: isLibraryMode, // Disable code-splitting for SDK
},
},