[go: nahoru, domu]

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

Support the new --profile flag when running vite build #332

Closed
2 tasks done
WagnerMoreira opened this issue Jan 10, 2023 · 1 comment
Closed
2 tasks done

Support the new --profile flag when running vite build #332

WagnerMoreira opened this issue Jan 10, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@WagnerMoreira
Copy link
WagnerMoreira commented Jan 10, 2023
  • I have tried upgrading by running bundle update vite_ruby.
  • I have read the troubleshooting section before opening an issue.

Description 📖

Reproduction 🐞

I added vite-ruby to an existing rails project that uses React for the UI, following the tutorial and all.

I noticed I had to add the file extension to the include tag otherwise the file would not be found
<%= vite_javascript_tag 'app.jsx' %>

I need to try the --profile flag because the app is too slow, it takes more than 15s to load the first page, I noticed that there are more than 1000 requests in the network tab because it's one request per react component file...
the live reload takes a long time as well, so after I change the code the browser takes 5s or more to pick up the changes

Why is the dev server not using configs from vite.config.ts? things like this lib import react from "@vitejs/plugin-react-swc" or "@vitejs/plugin-react" seem to help with slow load time in dev.

Vite Ruby Info

Run bin/rake vite:info and provide the output:

bin/vite present?: true
vite_ruby: 3.2.14
vite_rails: 3.0.13
rails: 7.0.4
node: v19.2.0
npm: 8.19.3
yarn: 1.22.19
pnpm:
ruby: ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [arm64-darwin21]

installed packages:
origin@0.1.0 /Users/wagnerdejesusmoreira/projects/origin
├─┬ @vitejs/plugin-react@3.0.1
│ └── vite@4.0.4 deduped
├─┬ vite-plugin-ruby@3.1.3
│ └── vite@4.0.4 deduped
└── vite@4.0.4

Logs 📜

If not providing a reproduction:

Output

Run DEBUG=vite-plugin-ruby:* bin/vite dev or DEBUG=vite-plugin-ruby:* bin/vite build and provide the output:

the only different thing that shows here is this, and then

➜  origin git:(rails-7-with-vite-ruby) ✗ DEBUG=vite-plugin-ruby:* bin/vite dev
  vite-plugin-ruby:config {
  vite-plugin-ruby:config   base: '/vite-dev/',
  vite-plugin-ruby:config   build: {
  vite-plugin-ruby:config     emptyOutDir: true,
  vite-plugin-ruby:config     sourcemap: false,
  vite-plugin-ruby:config     outDir: '../../public/vite-dev',
  vite-plugin-ruby:config     assetsDir: 'assets',
  vite-plugin-ruby:config     manifest: true,
  vite-plugin-ruby:config     rollupOptions: { input: [Object], output: [Object] }
  vite-plugin-ruby:config   },
  vite-plugin-ruby:config   envDir: '/Users/wagnerdejesusmoreira/projects/origin',
  vite-plugin-ruby:config   root: '/Users/wagnerdejesusmoreira/projects/origin/app/javascript',
  vite-plugin-ruby:config   server: {
  vite-plugin-ruby:config     fs: { allow: [Array], strict: true },
  vite-plugin-ruby:config     host: 'localhost',
  vite-plugin-ruby:config     https: false,
  vite-plugin-ruby:config     port: 3036,
  vite-plugin-ruby:config     strictPort: true,
  vite-plugin-ruby:config     hmr: { clientPort: 3036 }
  vite-plugin-ruby:config   },
  vite-plugin-ruby:config   entrypoints: {
  vite-plugin-ruby:config     'entrypoints/application.jsx': '/Users/wagnerdejesusmoreira/projects/origin/app/javascript/entrypoints/application.jsx',
  vite-plugin-ruby:config     'entrypoints/bkp.js': '/Users/wagnerdejesusmoreira/projects/origin/app/javascript/entrypoints/bkp.js'
  vite-plugin-ruby:config   }
  vite-plugin-ruby:config } +0ms

Screenshots 📷

Provide console or browser screenshots of the problem.

@WagnerMoreira WagnerMoreira added the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Jan 10, 2023
@ElMassimo ElMassimo added the enhancement New feature or request label Jan 16, 2023
@ElMassimo
Copy link
Owner

You can pass additional flags that the vite Ruby binary is not aware of by using the standard -- separator:

bin/vite build -- --profile

Will keep this open as a reminder to "natively" support this boolean flag added in Vite 4.

@ElMassimo ElMassimo removed the bug: pending triage Something doesn't seem to be working, but hasn't been verified label Jan 16, 2023
@ElMassimo ElMassimo changed the title cant we run vite with --profile? the binary does not accept this flag Support the new --profile flag when running vite build Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants