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

vite.config resolve.extensions.length=0 is error #4174

Closed
6 tasks done
jeff-fe opened this issue Jul 8, 2021 · 3 comments
Closed
6 tasks done

vite.config resolve.extensions.length=0 is error #4174

jeff-fe opened this issue Jul 8, 2021 · 3 comments

Comments

@jeff-fe
Copy link

jeff-fe commented Jul 8, 2021

Describe the bug

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  resolve: {
      extensions: []  // error
    },
  plugins: [vue()]
})

Reproduction

vite 2.4.1

System Info

System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 502.05 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - /usr/local/bin/npm
  Browsers:
    Firefox: 71.0
    Safari: 14.0.2
  npmPackages:
    @vitejs/plugin-vue: ^1.2.4 => 1.2.4
    vite: 2.3.7 => 2.3.7

Used Package Manager

npm

Logs

No response

Validations

@jeff-fe
Copy link
Author

jeff-fe commented Jul 8, 2021

hi @antfu ,I have other problem is not solved. Please help

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  resolve: {
      extensions: ['.js']
    },
  plugins: [vue()]
})

This config in vite 2.3.8 is work ok,
but in vite 2.4.0+ is error
@vite/client http request is 404 not found.

image

Thanks♪(・ω・)ノ

@jeff-fe jeff-fe changed the title vite.config resolve.extensions.lenght=0 is error vite.config resolve.extensions.length=0 is error Jul 8, 2021
@ygj6
Copy link
Member

ygj6 commented Jul 8, 2021

I am fixing this problem, because PR #4061 changed @vite/client to .mjs suffix

export const CLIENT_ENTRY = require.resolve('vite/dist/client/client.mjs')

Adding .mjs works fine

resolve: {
    extensions: ['.js','.mjs']
}

@jeff-fe
Copy link
Author

jeff-fe commented Jul 8, 2021

Thanks @ygj6

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

3 participants