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

配置chainWebpack 下 eruda 实例被重复创建 #5

Open
llemllen opened this issue Jan 13, 2020 · 8 comments
Open

配置chainWebpack 下 eruda 实例被重复创建 #5

llemllen opened this issue Jan 13, 2020 · 8 comments

Comments

@llemllen
Copy link

在 vue 项目中通过配置 configureWebpack 下的 plugins 配置项新增 eruda,表现正常.

现期待在 dev 环境下不开启, pro 环境下根据 某个环境变量判断是否开启.

现 chainWebpack 配置时, eruda 会被实例化4-5次

config
    .when(
        isPro && process.env.ERUDA,
        config => {
          config
            .plugin('ErudaWebpackPlugin')
            .use(require('eruda-webpack-plugin'), [{ force: true }])
            .end();
        }
      );

pic

@zimo2013
Copy link

我这边也是,1.2.0没有修复

@llemllen
Copy link
Author

我这边也是,1.2.0没有修复

我已经处理好了,通过添加entry,而且是需要处理可能含有hash的情况.
我根据打包后的app入口js文件来开启

config
      .when(
        isPro && process.env.ERUDA,
        config => {
          config
            .plugin('ErudaWebpackPlugin')
            .use(require('eruda-webpack-plugin'), [
              {
                force: true,
                entry: [/app.*\.js$/]
              }
            ])
            .end();
        }
      );

@zimo2013
Copy link

是的,指定一个entry就好了

@huruji
Copy link
Owner

huruji commented Jan 15, 2020

@d1313113 @zimo2013 目前只能通过指定 entry 来注入一个 js 文件

image

@huruji huruji reopened this Jan 15, 2020
@shamork
Copy link
Contributor

shamork commented Jul 19, 2021

if(!eruda._isInit) eruda.init()

@chenhebing
Copy link

他的入口文件还不是构建前的 还是取的asset 太low了吧

@shamork
Copy link
Contributor

shamork commented Oct 23, 2021

他的入口文件还不是构建前的 还是取的asset 太low了吧
@chenhebing
提交一个pull request 来改进下?

@shamork
Copy link
Contributor

shamork commented Oct 28, 2021

可以尝试下大于1.5.0的版本(当前尚未发布,预计几天之内应该可以看到新版本),解决了重复注入代码的问题 #26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants