Closed medzhidov closed 1 year ago
hi, your vite.config.js looks good, can you debug the writeBundle method to look bundles variable content ?
// node_modules/vite-plugin-symfony/dist/index.js
function default_1() {
return {
// ...
writeBundle(options, bundles) {
+ console.log(Object.keys(bundles))
if (!bundles["manifest.json"] || bundles["manifest.json"].type !== "asset") {
console.error("manifest.json not generated, vite-plugin-symfony need `build.manifest: true`");
process.exit(1);
}
const manifest = JSON.parse(bundles["manifest.json"].source.toString());
const entryPoints = (0, configResolver_1.getBuildEntryPoints)(viteConfig, manifest);
const assets = (0, assetsResolver_1.getAssets)(viteConfig, bundles);
(0, fileHelper_1.writeJson)(entryPointsPath, {
isProd: true,
viteServer: null,
entryPoints,
assets,
});
},
};
}
@lhapaipai
[
'auth-app-legacy.04b50c36.js',
'student-app-legacy.4853c965.js',
'EMessage-legacy.bb78742a.js',
'ELink-legacy.995d9ff5.js',
'ECheckbox-legacy.cd2deb88.js',
'LoginForm-legacy.8faa743b.js',
'RegisterForm-legacy.1ae2c76c.js',
'EPhoneInput-legacy.005e519a.js',
'SchoolCourses-legacy.555168d3.js',
'BaseFooter-legacy.ad2dc505.js',
'BaseMobileMenu-legacy.294a5a3f.js',
'EProgressPie-legacy.1bc9966c.js',
'CourseLearn-legacy.4f222f32.js',
'CourseAbout-legacy.67b5c253.js',
'CourseLesson-legacy.ffc446db.js',
'EFileUploadList-legacy.f6a3a41b.js',
'Profile-legacy.0663ca5d.js',
'ProfileSettings-legacy.ac35a355.js',
'PartnerProgram-legacy.728fe810.js',
'NotFound-legacy.8134692a.js',
'CourseHeader-legacy.75a4baa3.js',
'blockMixin-legacy.876d4729.js',
'WhoSuitsCourse-legacy.c0da224f.js',
'WhatWillYouLearn-legacy.6e04202d.js',
'HowTrainingGoing-legacy.f3eb71d4.js',
'CourseProgram-legacy.091ac788.js',
'Teachers-legacy.0125975b.js',
'Reviews-legacy.4ae7e790.js',
'Order-legacy.eec891fb.js',
'OrderPlan-legacy.4bd4b4fa.js',
'Faq-legacy.776d22d6.js',
'LandingFooter-legacy.d09af899.js',
'polyfills-legacy.ea892b5b.js'
]
If i disable legacy plugin i got the same error with these bundles:
[
'auth-app.318c3a79.js',
'student-app.baeecc8d.js',
'EMessage.543d9fc5.js',
'ELink.d2451098.js',
'ECheckbox.ab977f2d.js',
'LoginForm.310d6437.js',
'RegisterForm.afad34c9.js',
'EPhoneInput.33e39b86.js',
'SchoolCourses.8480f300.js',
'BaseFooter.0fc97e27.js',
'BaseMobileMenu.e2b322f4.js',
'EProgressPie.6a617ec2.js',
'CourseLearn.f25833d7.js',
'CourseAbout.0236c582.js',
'CourseLesson.9b8efa05.js',
'EFileUploadList.62197458.js',
'Profile.4600bd6d.js',
'ProfileSettings.9a00b57b.js',
'PartnerProgram.a5a8f415.js',
'NotFound.56bf7448.js',
'CourseHeader.9a70aaf2.js',
'blockMixin.4952f7fb.js',
'WhoSuitsCourse.6bcc165e.js',
'WhatWillYouLearn.0d0fa3eb.js',
'HowTrainingGoing.414a825d.js',
'CourseProgram.6952aadd.js',
'Teachers.c353f674.js',
'Reviews.c5189bbb.js',
'Order.c03f9d6b.js',
'OrderPlan.82200ff4.js',
'Faq.4e148089.js',
'LandingFooter.7ba713a4.js',
'ELink.d9765b90.css',
'Order.022b347c.css',
'BaseFooter.884626ca.css',
'HowTrainingGoing.cb376105.css',
'PartnerProgram.b8430de8.css',
'ProfileSettings.535979a4.css',
'LandingFooter.cf05640f.css',
'CourseProgram.4cff9a53.css',
'EProgressPie.ee781cba.css',
'SchoolCourses.67cd8052.css',
'Teachers.fbdbaa68.css',
'EFileUploadList.362e47fd.css',
'CourseHeader.003ab08c.css',
'OrderPlan.3620be87.css',
'LoginForm.5e09f1f6.css',
'Reviews.ba8208f5.css',
'CourseLearn.9e3b88b1.css',
'app.f0ca1d60.css',
'WhoSuitsCourse.19245135.css',
'Faq.1d076b63.css',
'RegisterForm.745610dc.css',
'CourseLesson.6cd6f363.css',
'WhatWillYouLearn.20a4e39d.css',
'BaseMobileMenu.95bd227d.css',
'ECheckbox.67390e8a.css',
'EMessage.a8e39b73.css',
'app.a3c1aaff.css'
]
strange you have set the option build.manifest
to true
so this file must be generated and this is not the case. vite-plugin-symfony therefore cannot do its job.
if you build without the vite-plugin-symfony plugin is your manifest.json file generated ?
can you give me a way to reproduce the problem otherwise it will be difficult for me to find the solution
without news and having not been able to reproduce the problem I close the issue. if the problem reoccurs and you have any further information to provide, please reopen this issue
The problem persists exactly as medzhidov described so I would be interested in a solution. How can I help you narrow down the problem?
hi @friebe can you give me a minimal fully fonctional config so that I can reproduce your issue ?
here is a my minimal config
import { defineConfig } from 'vite';
import symfonyPlugin from 'vite-plugin-symfony';
import vue from '@vitejs/plugin-vue2';
import legacy from '@vitejs/plugin-legacy'
export default defineConfig({
plugins: [
legacy({
targets: ['defaults', 'not IE 11']
}),
vue(),
symfonyPlugin()
],
root: '.',
base: '/base/build/',
publicDir: false,
build: {
manifest: true,
emptyOutDir: true,
assetsDir: '',
outDir: './web/base/build',
rollupOptions: {
input: {
// // Legacy Config
'global/legacy.main': './src-frontend/js/global/legacy.main.js',
// Vue-Config
'bilanz/main': './src-frontend/vue/bilanz/main.ts',
// SCSS-Config
'theme-ballyhoura': './src-frontend/scss/100-themes/theme-ballyhoura.scss'
}
}
}
});
can you give me your package.json and output the npx envinfo --npmPackages
?
I am unable to reproduce your problem with this configuration file and the latest versions of the packages, do you have their latest versions? could you give me a feedback with :
apart from this issue you will have to use with composer
I'm facing the same issue using latest versions of both vite (3.2.2), vite-bundle (v2.2.1) and vite-plugin-symfony (0.6.3).
Looks like it is related to @vitejs/plugin-legacy. If I remove the plugin-legacy from the vite plugins configuration, vite-plugin-symfony stops complaining about the wrong build.manifest configuration and run as expected.
Here is the output of my npx envinfo --npmPackages
command:
@alpinejs/persist: ^3.10.3 => 3.10.5
@fullhuman/postcss-purgecss: ^4.0.3 => 4.1.3
@vitejs/plugin-legacy: ^2.3.0 => 2.3.0
alpinejs: ^3.10.5 => 3.10.5
autoprefixer: ^10.3.1 => 10.4.13
chalk: ^4.1.1 => 4.1.2
chokidar: ^3.5.2 => 3.5.3
cross-env: ^7.0.3 => 7.0.3
dotenv: ^10.0.0 => 10.0.0
fantasticon: ^1.2.3 => 1.2.3
htmx.org: 1.7.0 => 1.7.0
lint-staged: ^13.0.0 => 13.0.3
orejime: ^2.2.1 => 2.2.1
postcss: ^8.3.6 => 8.4.18
postcss-cli: ^8.3.1 => 8.3.1
postcss-import: ^14.0.2 => 14.1.0
precss: ^4.0.0 => 4.0.0
prettier: 2.6.2 => 2.6.2
purgecss: ^4.0.3 => 4.1.3
rollup-plugin-critical: ^1.0.7 => 1.0.9
rollup-plugin-imagemin: ^0.4.1 => 0.4.1
tailwindcss: ^3.0.24 => 3.2.1
terser: ^5.14.2 => 5.15.1
vite: ^3.2.2 => 3.2.2
vite-plugin-restart: ^0.0.2 => 0.0.2
vite-plugin-symfony: ^0.6.3 => 0.6.3
ok thanks I can reproduce the issue !
I will see how the plugin behaves to try to reproduce its behavior for the generation of the entrypoints.json
file. it seems to do a 2-pass build without manifest generation for legacy files.
Hi, I've made an update vite-plugin-symfony : 0.7.0 pentatrion/vite-bundle : v2.3.0 this update takes into account the @vitejs/plugin-legacy plugin and should solve your problem.
@lhapaipai Thank you. Looks good, everything is working fine now with @vitejs/plugin-legacy activated.
Hi! I got an error
manifest.json not generated, vite-plugin-symfony need 'build.manifest: true'
, but my config should be correct: