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

False positive error message #10923

Closed
unional opened this issue Nov 14, 2022 · 1 comment
Closed

False positive error message #10923

unional opened this issue Nov 14, 2022 · 1 comment

Comments

@unional
Copy link

unional commented Nov 14, 2022

Describe the bug

"build.lib.formats" will be ignored because "build.rollupOptions.output" is already an array format

I need to use build.rollupOptions.output, e.g.:

{
  build: {
    rollupOptions: {
      output: [
        { dir: 'cjs', format: 'cjs', sourcemap: true },
        { dir: 'esm', format: 'es', sourcemap: true }
      ]
    }
  }
} 

When I skip build.lib.formats, it will fail with:

Option "build.lib.name" is required when output formats include "umd" or "iife".

but it is not building umd or iife, thus build.lib.name is not needed.

Currently, I have to either declare a phantom build.lib.name, or build.lib.formats: [] which will emit this warning.

Reproduction

https://stackblitz.com/edit/vitejs-vite-3dmwtq?file=vite.config.js

Steps to reproduce

build

System Info

System:
    OS: macOS 12.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 95.92 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Brave Browser: 107.1.45.123
    Chrome: 107.0.5304.110
    Firefox: 105.0.3
    Safari: 16.1

Used Package Manager

pnpm

Logs

Click to expend! ```sh > vite build "--" "--debug"

vite:config bundled config file loaded in 525.33ms +0ms
vite:esbuild init tsconfck (root: /Users/hwong/pan/pats) +0ms
vite:esbuild init tsconfck (root: /Users/hwong/pan/pats) +66ms
vite:esbuild init tsconfck (root: /Users/hwong/pan/pats) +0ms
vite:esbuild init tsconfck (root: /Users/hwong/pan/pats) +0ms
vite:esbuild init tsconfck end +249ms
vite:esbuild init tsconfck end +0ms
vite:esbuild init tsconfck end +0ms
vite:esbuild init tsconfck end +0ms
vite:config using resolved config: {
vite:config plugins: [
vite:config 'vite:build-metadata',
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'vite:react-babel',
vite:config 'vite:react-refresh',
vite:config 'vite:react-jsx',
vite:config 'node-externals',
vite:config 'vite-plugin-windicss:alias',
vite:config 'vite-plugin-windicss:groups',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-proxy',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm-helper',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite-plugin-windicss',
vite:config 'vite-plugin-windicss:css',
vite:config 'vite-plugin-windicss:css:svelte',
vite:config 'vite-plugin-windicss:devtools',
vite:config 'vite:wasm-fallback',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'vite:worker-import-meta-url',
vite:config 'vite:force-systemjs-wrap-complete',
vite:config 'vite:watch-package-data',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'vite:asset-import-meta-url',
vite:config 'typescript',
vite:config 'vite:dynamic-import-vars',
vite:config 'vite:import-glob',
vite:config 'vite-plugin-windicss:entry',
vite:config 'vite:build-import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter',
vite:config 'vite:load-fallback'
vite:config ],
vite:config build: {
vite:config target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
vite:config polyfillModulePreload: true,
vite:config outDir: 'dist',
vite:config assetsDir: 'assets',
vite:config assetsInlineLimit: 4096,
vite:config cssCodeSplit: false,
vite:config cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari13' ],
vite:config sourcemap: true,
vite:config rollupOptions: { plugins: [Array], output: [Array] },
vite:config minify: 'esbuild',
vite:config terserOptions: {},
vite:config write: true,
vite:config emptyOutDir: null,
vite:config manifest: false,
vite:config lib: {
vite:config entry: '/Users/hwong/pan/pats/components/react-ui/ts/index.ts',
vite:config fileName: 'pats-react-ui',
vite:config formats: []
vite:config },
vite:config ssr: false,
vite:config ssrManifest: false,
vite:config reportCompressedSize: true,
vite:config chunkSizeWarningLimit: 500,
vite:config watch: null,
vite:config commonjsOptions: { include: [Array], extensions: [Array] },
vite:config dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] }
vite:config },
vite:config test: {
vite:config environment: 'jsdom',
vite:config setupFiles: 'scripts/test-setup.ts',
vite:config threads: false
vite:config },
vite:config resolve: {
vite:config alias: [ [Object], [Object], [Object] ],
vite:config dedupe: [ 'react', 'react-dom' ]
vite:config },
vite:config optimizeDeps: {
vite:config disabled: 'build',
vite:config force: undefined,
vite:config include: [ 'react/jsx-runtime', 'react/jsx-dev-runtime', 'react' ],
vite:config esbuildOptions: { preserveSymlinks: undefined }
vite:config },
vite:config configFile: '/Users/hwong/pan/pats/components/react-ui/vite.config.ts',
vite:config configFileDependencies: [ '/Users/hwong/pan/pats/components/react-ui/vite.config.ts' ],
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 optimizeDeps: { force: undefined },
vite:config build: {}
vite:config },
vite:config root: '/Users/hwong/pan/pats/components/react-ui',
vite:config base: '/',
vite:config publicDir: '/Users/hwong/pan/pats/components/react-ui/public',
vite:config cacheDir: '/Users/hwong/pan/pats/components/react-ui/node_modules/.vite',
vite:config command: 'build',
vite:config mode: 'production',
vite:config ssr: {
vite:config format: 'esm',
vite:config target: 'node',
vite:config optimizeDeps: { disabled: true, esbuildOptions: [Object] }
vite:config },
vite:config isWorker: false,
vite:config mainConfig: null,
vite:config isProduction: true,
vite:config server: {
vite:config preTransformRequests: true,
vite:config middlewareMode: false,
vite:config fs: { strict: true, allow: [Array], deny: [Array] }
vite:config },
vite:config preview: {
vite:config port: undefined,
vite:config strictPort: undefined,
vite:config host: undefined,
vite:config https: undefined,
vite:config open: undefined,
vite:config proxy: undefined,
vite:config cors: undefined,
vite:config headers: undefined
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 hasErrorLogged: [Function: hasErrorLogged]
vite:config },
vite:config packageCache: Map(0) { set: [Function (anonymous)] },
vite:config createResolver: [Function: createResolver],
vite:config worker: {
vite:config format: 'iife',
vite:config plugins: [
vite:config 'vite:build-metadata',
vite:config 'vite:pre-alias',
vite:config 'alias',
vite:config 'vite:modulepreload-polyfill',
vite:config 'vite:resolve',
vite:config 'vite:html-inline-proxy',
vite:config 'vite:css',
vite:config 'vite:esbuild',
vite:config 'vite:json',
vite:config 'vite:wasm-helper',
vite:config 'vite:worker',
vite:config 'vite:asset',
vite:config 'vite:wasm-fallback',
vite:config 'vite:define',
vite:config 'vite:css-post',
vite:config 'vite:build-html',
vite:config 'vite:worker-import-meta-url',
vite:config 'vite:force-systemjs-wrap-complete',
vite:config 'vite:watch-package-data',
vite:config 'commonjs',
vite:config 'vite:data-uri',
vite:config 'vite:asset-import-meta-url',
vite:config 'typescript',
vite:config 'vite:dynamic-import-vars',
vite:config 'vite:import-glob',
vite:config 'vite:build-import-analysis',
vite:config 'vite:esbuild-transpile',
vite:config 'vite:terser',
vite:config 'vite:reporter',
vite:config 'vite:load-fallback'
vite:config ],
vite:config rollupOptions: {},
vite:config getSortedPlugins: [Function: getSortedPlugins],
vite:config getSortedPluginHooks: [Function: getSortedPluginHooks]
vite:config },
vite:config appType: 'spa',
vite:config experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false },
vite:config getSortedPlugins: [Function: getSortedPlugins],
vite:config getSortedPluginHooks: [Function: getSortedPluginHooks]
vite:config } +320ms
vite v3.1.8 building for production...
"build.lib.formats" will be ignored because "build.rollupOptions.output" is already an array format
✓ 52 modules transformed.
cjs/pats-react-ui.cjs 14.46 KiB / gzip: 4.70 KiB
cjs/pats-react-ui.cjs.map 57.96 KiB
esm/pats-react-ui.js 19.42 KiB / gzip: 5.23 KiB
esm/pats-react-ui.js.map 61.64 KiB

</details>

### Validations

- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to [vuejs/core](https://github.com/vuejs/core) instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
@sapphi-red
Copy link
Member

This is fixed by #9886 and will be released in 4.0.0.

@github-actions github-actions bot locked and limited conversation to collaborators Nov 30, 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

2 participants