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

[bug] React refresh won't work if base was set other than default /. #1787

Closed
3 tasks done
Ynewtime opened this issue Jan 29, 2021 · 1 comment
Closed
3 tasks done

Comments

@Ynewtime
Copy link

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

If base was configured, like /sub/, react refresh won't work.

Reproduction

Repo to reproduce.

System Info

  • vite version: 2.0.0-beta.56
  • Operating System: Windows 10 20H2 19042.685
  • Node version: v15.6.0
  • Package manager (npm/yarn/pnpm) and version: yarn 1.22.10

Logs (Optional if provided reproduction)

vite:config bundled config file loaded in 123ms +0ms
  vite:config using resolved config: {
  vite:config   base: '/sub/',
  vite:config   plugins: [
  vite:config     'vite:pre-alias',
  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     'react-refresh',
  vite:config     'vite:css-post',
  vite:config     'vite:client-inject',
  vite:config     'vite:import-analysis'
  vite:config   ],
  vite:config   server: {},
  vite:config   configFile: '/home/ubuntu-y/dev/vite-project/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     server: {}
  vite:config   },
  vite:config   root: '/home/ubuntu-y/dev/vite-project',
  vite:config   command: 'serve',
  vite:config   mode: 'development',
  vite:config   isProduction: false,
  vite:config   optimizeCacheDir: '/home/ubuntu-y/dev/vite-project/node_modules/.vite',
  vite:config   alias: [ { find: /^\/@vite\//, replacement: [Function: replacement] } ],
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge16', 'firefox60', 'chrome61', 'safari11' ],
  vite:config     polyfillDynamicImport: true,
  vite:config     outDir: 'dist',
  vite:config     assetsDir: 'assets',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  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: false,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false
  vite:config   },
  vite:config   env: { BASE_URL: '/sub/', MODE: 'development', DEV: true, PROD: false },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen]
  vite:config   },
  vite:config   createResolver: [Function: createResolver]
  vite:config } +4ms
  vite:deps Crawling dependencies using entries:
  vite:deps   /home/ubuntu-y/dev/vite-project/index.html +0ms
  vite:resolve 1ms   /src/main.tsx -> /home/ubuntu-y/dev/vite-project/src/main.tsx +0ms
  vite:resolve 6ms   react -> /home/ubuntu-y/dev/vite-project/node_modules/react/index.js +10ms
  vite:resolve 3ms   react-dom -> /home/ubuntu-y/dev/vite-project/node_modules/react-dom/index.js +4ms
  vite:resolve 2ms   ./App -> /home/ubuntu-y/dev/vite-project/src/App.tsx +3ms
  vite:deps Scan completed in 94ms: {
  react: '/home/ubuntu-y/dev/vite-project/node_modules/react/index.js',
  'react-dom': '/home/ubuntu-y/dev/vite-project/node_modules/react-dom/index.js'
} +66ms
Pre-bundling dependencies:
react, react-dom
(this will be run only when your dependencies or config have changed)
  vite:resolve 1ms   object-assign -> null +0ms
  vite:resolve 5ms   object-assign -> /home/ubuntu-y/dev/vite-project/node_modules/object-assign/index.js +0ms
  vite:resolve 0ms   scheduler -> null +54ms
  vite:resolve 4ms   scheduler -> /home/ubuntu-y/dev/vite-project/node_modules/scheduler/index.js +49ms
  vite:resolve 0ms   scheduler/tracing -> null +4ms
  vite:resolve 1ms   scheduler/tracing -> /home/ubuntu-y/dev/vite-project/node_modules/scheduler/tracing.js +2ms
  vite:deps deps bundled in 168ms +0ms

  ⚡Vite dev server running at:

  > Local:    http://localhost:3000/sub/
  > Network:  http://100.65.74.141:3000/sub/

  ready in 529ms.
@yyx990803
Copy link
Member

fixed in @vitejs/plugin-react-refresh@1.1.3

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