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 report] 使用vite开发时报错,引入jsdom导致,可以动态引入 #78

Closed
gongliangshuai opened this issue Dec 29, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@gongliangshuai
Copy link

企业微信截图_ce2d6dd1-23c9-4eb0-a917-02d6aac01e27
wecom-temp-a198d9dc71776a35f5b4ad28b386ecfe

@lyngai
Copy link
Collaborator

lyngai commented Dec 29, 2021

已知的 BUG,在下一个版本我们会将 browser 和 node 版本的包分开打包。目前浏览器环境可以先按下方配置规避该问题。

// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      // jsdom 解析到空文件
      jsdom: path.resolve(__dirname, 'src', 'empty.js'),
    },
  },
});

empty.js 参考如下

// src/empty.js
export const JSDOM = {};

@lyngai lyngai added the bug Something isn't working label Dec 29, 2021
@lyngai lyngai mentioned this issue Dec 29, 2021
@lyngai
Copy link
Collaborator

lyngai commented Jan 4, 2022

issue 先关闭了,新版本(v0.6.1)实测已修复该问题。

@lyngai lyngai closed this as completed Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants