code splitting on build is not working
See original GitHub issueEnvironment
- Operating System:
Windows_NT
- Node Version:
v16.15.1
- Nuxt Version:
3.0.0-rc.6
- Package Manager:
yarn@1.22.15
- Builder:
vite
- User Config:
modules
,ssr
,modern
,build
,css
,buildModules
,runtimeConfig
,vite
,builder
,webpack
- Runtime Modules:
@nuxt/image-edge@1.0.0-27628766.3629b9a
,~/modules/home/index.ts
,~/modules/product/index.ts
,~/modules/catalog/index.ts
,~/modules/cart/index.ts
,~/modules/common/index.ts
,~/modules/productRowSlider/index.ts
,~/modules/productCard/index.ts
,~/modules/header/index.ts
,~/modules/shop/index.ts
,~/modules/staticPages/index.ts
,~/modules/notifications/index.ts
- Build Modules:
@pinia/nuxt@0.3.0
Reproduction
Can’t provide reproduction. Cause it’s private
Describe the bug
I m developing project in DDD pattern. In my project every page is seperate module. I have imported every css (scss) files seperately on its module. In vite configs I have set build.cssTarget to true and lib mode false. I have built my project with vite bundler. But bundler generated files strangely. As you can see on the photo below, bundler generated only 4 css files. All the styles are merged into entry.611f2b22.css file except other 3 css files on the photo. But I have imported css files seperately inside its page or components.
Additional context
Actually I need to speed up project. But my performance score on Lighthouse is below 45 on average and in some pages even below 20. I need to split all the js and css files as much as possible, need to reduce unused styles on every page. That is why code splitting is very important for me. I have tried wite optimal vite config. But I think some vite configs are not working or I am using it in a wrong way. Could somebody help me with setting up vite config?
My nuxt config file:
Also I have tried to build with webpack and on nuxt config set builder to ‘webpack’. But it didn’t help me and some errors occured during build.
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (2 by maintainers)
Top GitHub Comments
Sorry I accidentally clicked to close with comment button
@MohammadKhalaji If you are encountering something similar, or the same, please open a new issue with a reproduction. 🙏