kucrut/vite-for-wp

Assets are not bundled in dev mode, only in production mode

dingo-d opened this issue · 1 comments

My plugin has the assets inside the plugin/assets/dev folder. The entry point is the plugin/assets/dev/application.js file that has imports for the scss and js (jsx files)

my-plugin/
├ assets/
| └ dev/
|   ├ scripts/
|   ├ styles/
|   └ application.js
├ package.json
├ plugin.php
└ vite.config.js

The production build will create a assets/public folder with the correct manifest and compiled files (CSS looks ok, I don't get any errors in JS ones, but the admin doesn't render so I need to check what happens here, probably some react stuff).

The thing is, when I run npm run dev to run the vite command, all I get in the public folder is the vite-dev-server.json file with

{"base":"/","origin":"http://localhost:5174","port":5174,"plugins":[]}

in it. No assets get bundled 🤷🏼‍♂️

What am I missing?

Ok, figured out that I need to enqueue assets using the provided helpers. It all seems to be working (kinda) now 👍🏼