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-plugin-posthtml] Crashes on Node.js v16.8.0 #85

Closed
vsnthdev opened this issue Aug 27, 2021 · 8 comments · May be fixed by #130
Closed

[vite-plugin-posthtml] Crashes on Node.js v16.8.0 #85

vsnthdev opened this issue Aug 27, 2021 · 8 comments · May be fixed by #130

Comments

@vsnthdev
Copy link

vsnthdev commented Aug 27, 2021

Vite build fails due to vite-plugin-posthtml when executed on Node.js v16.8.0 with the following error 👇

failed to load config from /Users/vasanth/Movies/hello-world/vite.config.js
error during build:
TypeError [ERR_INVALID_ARG_VALUE]: The property 'options.entryTypes' options.entryTypes can not set with options.type together. Received [ 'measure' ]
    at new NodeError (node:internal/errors:371:5)
    at PerformanceObserver.observe (node:internal/perf/observe:220:13)
    at posthtmlPlugin (/Users/vasanth/Movies/hello-world/node_modules/vite-plugin-posthtml/index.js:32:12)
    at default (file:///Users/vasanth/Movies/hello-world/vite.config.js?t=1630095273376:18:13)
    at loadConfigFromFile (/Users/vasanth/Movies/hello-world/node_modules/vite/dist/node/chunks/dep-972722fa.js:75866:15)
    at async resolveConfig (/Users/vasanth/Movies/hello-world/node_modules/vite/dist/node/chunks/dep-972722fa.js:75434:28)
    at async doBuild (/Users/vasanth/Movies/hello-world/node_modules/vite/dist/node/chunks/dep-972722fa.js:51931:20)
    at async build (/Users/vasanth/Movies/hello-world/node_modules/vite/dist/node/chunks/dep-972722fa.js:51919:16)
    at async CAC.<anonymous> (/Users/vasanth/Movies/hello-world/node_modules/vite/dist/node/cli.js:13998:9)

🛠 Steps to reproduce

  1. Be on the latest Node.js version v16.8.0
  2. Create a package.json
  3. Install Vite & vite-plugin-posthtml as devDependencies
  4. Set the property: "type": "module" in package.json to use ESM modules
  5. Add the following content in vite.config.js 👇
import { defineConfig } from 'vite'
import { posthtmlPlugin } from 'vite-plugin-posthtml'

export default () =>
    defineConfig({
        plugins: [
            // run PostHTML to construct the dist
            posthtmlPlugin({
                // PostHTML config
            }),
        ],
    })
  1. Create src/index.html file
  2. Run npx vite --config vite.config.js build src
  3. There's the error 🙌

Version Information:

  1. node: v16.8.0
  2. npm: v7.21.0
  3. vite: v2.5.1
  4. vite-plugin-posthtml: v0.0.3

🔬 Additional Context

The latest known version of Node.js in which the plugin works perfectly is v16.6.2 and vite-plugin-posthtml starts to crash right from the next release.

Thank you 😊

@zsdycs
Copy link

zsdycs commented Jan 9, 2022

This is a fatal bug !

I'm doing a build in github action and the problem occurs in both node version 16.6.2 and node version 14.18.2.

The strange thing is that when I buiid the same above node version on local windows there is no problem.

But for now, it is clear that this problem is generated by the following code👇:

observer.observe({ entryTypes: ['measure'], type: 'measure' });

Can be obtained from document PerformanceObserver.observe().

image

@zsdycs
Copy link

zsdycs commented Jan 9, 2022

I fixed the error after making the following changes👇:

- observer.observe({ entryTypes: ['measure'], type: 'measure' }); 
+ observer.observe({ entryTypes: ['measure'] });

@pierremouchan
Copy link

This behavior still appears on my code, did you made pull request concerning this one? @zsdycs

@zsdycs
Copy link

zsdycs commented Jan 29, 2022

This behavior still appears on my code, did you made pull request concerning this one? @zsdycs

👌

@zsdycs
Copy link

zsdycs commented Jan 29, 2022

I'll submit a merger request later. But I think the merger will take some time. Because it seems that this library has not been active for a long time.

I suggest using this to solve your problem quickly. Replace this library with your own code.

@Snugug
Copy link
Collaborator

Snugug commented Jan 30, 2022 via email

@samjeffress
Copy link

@Snugug any word on the cleanup or if we should switch to a different option?

@zsdycs
Copy link

zsdycs commented Oct 12, 2023

I'll submit a merger request later. But I think the merger will take some time. Because it seems that this library has not been active for a long time.我稍后会提交合并请求。但我认为合并需要一些时间。因为这个库似乎很久没有活跃了。

I suggest using this to solve your problem quickly. Replace this library with your own code.我建议使用它来快速解决您的问题。将此库替换为您自己的代码。

Sorry, I forgot to submit the PR. You can follow the merger status of this PR for this issue.

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

Successfully merging a pull request may close this issue.

5 participants