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

Builds with cssCodeSplit disabled don't include name of generated CSS file in manifest.json #3629

Closed
6 tasks done
barryp opened this issue Jun 1, 2021 · 2 comments
Closed
6 tasks done

Comments

@barryp
Copy link

barryp commented Jun 1, 2021

Describe the bug

When build.cssCodeSplit is set to false, and build.manifest is true, the CSS that's generated is not included in the manifest.json file - which seems necessary for using the Vite backend integration directions, where you're not using the generated dist/index.html (which does link to the generated CSS)

Reproduction

I setup an example repo, which is an app created by running yarn create @vitejs/app, selecting vue and the non-TS variant. The only change made is to vite.config.js to disable cssCodeSplit and enable manifest generation.

After running npx vite build, a file named style.2bb9ff70.css was generated, but no mention of it appears in dist/manifest.json

The contents of dist/manifest.json are:

{
  "index.html": {
    "file": "assets/index.8d845e67.js",
    "src": "index.html",
    "isEntry": true,
    "imports": [
      "_vendor.642d02b4.js"
    ],
    "assets": [
      "assets/logo.03d6d6da.png"
    ]
  },
  "_vendor.642d02b4.js": {
    "file": "assets/vendor.642d02b4.js"
  }
}

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

  System:
    OS: macOS 11.3.1
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 679.91 MB / 32.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 14.15.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
  Browsers:
    Chrome: 91.0.4472.77
    Firefox: 89.0
    Firefox Developer Edition: 62.0
    Safari: 14.1
  npmPackages:
    @vitejs/plugin-vue: ^1.2.3 => 1.2.3
    vite: ^2.3.5 => 2.3.5

Used package manager: yarn

Logs

  vite:config bundled config file loaded in 90ms +0ms
  vite:config using resolved config: {
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillDynamicImport: false,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: false,
  vite:config     sourcemap: false,
  vite:config     rollupOptions: {},
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     minify: 'terser',
  vite:config     terserOptions: {},
  vite:config     cleanCssOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: null,
  vite:config     manifest: true,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     brotliSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null
  vite:config   },
  vite:config   plugins: [
  vite:config     'alias',
  vite:config     'vite:dynamic-import-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'vite:vue',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'vite:import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:manifest',
  vite:config     'vite:reporter'
  vite:config   ],
  vite:config   define: { __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false },
  vite:config   ssr: { external: [ 'vue', '@vue/server-renderer' ] },
  vite:config   configFile: '/Users/barryp/github/vite-css-code-split/vite.config.js',
  vite:config   configFileDependencies: [ 'vite.config.js' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     build: {}
  vite:config   },
  vite:config   root: '/Users/barryp/github/vite-css-code-split',
  vite:config   base: '/',
  vite:config   resolve: { dedupe: undefined, alias: [ [Object] ] },
  vite:config   publicDir: '/Users/barryp/github/vite-css-code-split/public',
  vite:config   cacheDir: '/Users/barryp/github/vite-css-code-split/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   server: {
  vite:config     fsServe: { root: '/Users/barryp/github/vite-css-code-split', strict: false }
  vite:config   },
  vite:config   env: { BASE_URL: '/', MODE: 'production', DEV: false, PROD: true },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen]
  vite:config   },
  vite:config   createResolver: [Function: createResolver],
  vite:config   optimizeDeps: { esbuildOptions: { keepNames: undefined } }
  vite:config } +5ms
vite v2.3.5 building for production...
✓ 12 modules transformed.
dist/assets/logo.03d6d6da.png    6.69kb
dist/index.html                  0.47kb
dist/manifest.json               0.28kb
dist/assets/style.2bb9ff70.css   0.20kb / brotli: 0.12kb
dist/assets/index.8d845e67.js    0.84kb / brotli: 0.45kb
dist/assets/vendor.642d02b4.js   42.44kb / brotli: 15.34kb

Before submitting the issue, please make sure you do the following

@spacedawwwg
Copy link

#6477

@bluwy
Copy link
Member

bluwy commented Mar 11, 2022

Looks like #6477 duplicates this, but it has more discussion there. I'll close this in favour of that to keep the issues lean. Please subscribe to that issue to get notifications when that's addressed.

@bluwy bluwy closed this as completed Mar 11, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants