I’m trying to migrate from @symfony/webpack-encore
migration to vite-plugin-symfony
and got an issue.
When webpack-encore dev server starts, it generates chunks under Encore.setOutputPath('web/assets/')
directory, which is not the case for vite-plugin-symfony
. It just generates web/assets/.vite/entrypoints.json
. Here is an example:
"entryPoints": {
"app": {
"js": [
"http://localhost:8080/web/vwm/js/app.js"
]
},
"chosen": {
"js": [
"http://localhost:8080/web/vwm/js/chosen.js"
]
},
"jquery": {
"js": [
"http://localhost:8080/web/vwm/js/jquery-webpack.js"
]
},
"users-legacy": {
"js": [
"http://localhost:8080/web/src/modules/classes/Apps/User/Resources/assets/js/users.js"
]
},
...
}
export default defineConfig({
plugins: [
symfonyPlugin(),
vue({
template: {
transformAssetUrls: {
includeAbsolute: false,
base: null,
},
},
}),
],
server: {
host: true,
port: 8000
},
preview: {
host: true,
port: 8000
},
root: './',
base: '/assets',
publicDir: false,
resolve: {
extensions: ['.js', '.json', '.vue', '.ts'],
alias: {
root: path.resolve(__dirname, './'),
...
},
},
build: {
emptyOutDir: false,
sourcemap: process.env.MODE !== 'production',
manifest: true,
cssCodeSplit: false,
outDir: 'web/',
rollupOptions: {
input: {
'users-legacy': path.resolve(__dirname,'./src/modules/classes/VWM/Apps/Resources/assets/js/users.js'),
},
},
},
appType: 'mpa'
});
Basically I’m trying to achieve ‘webpack-like’ behaviour for vite, where files for dev server is served into a web/assets
folder. I tried to use vite build --watch
command, but it takes 30 second for both starting a server and reloading it after changes.
unkwnprx is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.