Skip to content

Bug: Cannot redefine property: nodeName when beasties is added #263

@EmmaKnijn

Description

@EmmaKnijn

I am trying to use beasties in my project, and it is failing to build the server ssg environment when I run npm run build. The moment that I remove beasties the build goes through fine

vite.config.js:

import { fileURLToPath, URL } from 'node:url'
import { beasties } from 'vite-plugin-beasties'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),

    beasties({
      // Plugin options
      options: {
        // Beasties library options
        inlineThreshold: 4000, // Inline stylesheets smaller than 4kb
      },
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
  build: {
    // Generate static assets in the dist directory
    outDir: 'dist',
    // Ensure all assets are included in the build
    assetsInlineLimit: 0,
    // Optimize the build for production
    minify: 'terser',
    // Generate source maps for debugging
    sourcemap: false,
    // Configure rollup options
    rollupOptions: {
      output: {
        // Ensure assets are properly named
        entryFileNames: 'assets/[name].[hash].js',
        chunkFileNames: 'assets/[name].[hash].js',
        assetFileNames: 'assets/[name].[hash].[ext]'
      }
    }
  },
  server: {allowedHosts: true}
})

logs:

PS C:\Users\Emma\Documents\GitHub\ndov-website> npm run build

> ndov-website@0.0.0 build
> vite-ssg build

(node:67220) Warning: `--localstorage-file` was provided without a valid path
(Use `node --trace-warnings ...` to show where the warning was created)

[vite-ssg] Build for client...
vite v7.2.2 building client environment for production...
✓ 96 modules transformed.
rendering chunks (1)...Inlined 470 bytes (1% of original 28.18 kB) of assets/app.C0daZc1Z.css.
Time 25ms
Error: ENOENT: no such file or directory, open 'C:\Users\Emma\Documents\GitHub\ndov-website\dist\assets\app.C0daZc1Z.css'
dist/index.html                 1.42 kB │ gzip:  0.69 kB
dist/.vite/ssr-manifest.json    3.62 kB │ gzip:  0.81 kB
dist/assets/app.C0daZc1Z.css   28.37 kB │ gzip:  5.43 kB
dist/assets/app.Cj26nEtN.js   291.38 kB │ gzip: 69.37 kB
✓ built in 4.74s

[vite-ssg] Build for server...
vite v7.2.2 building ssr environment for production...
✓ 47 modules transformed.
.vite-ssg-temp/gdb4q85sp2/main.mjs  235.09 kB
✓ built in 2.85s

[vite-ssg] Rendering Pages... (6)
[vite-ssg] Critical CSS generation enabled via `beasties`
HTM 2026-01-17T10:32:46.792Z 1970-02-05T01:59:59.974Z
HTM HTM
RET Bus 2026-01-17T10:32:47.423Z 1970-02-05T01:59:59.343Z
RET RET Bus
Arriva Bus 2026-01-17T10:32:47.000Z 1970-02-05T01:59:59.766Z
ARR Arriva Bus
DITP 2026-01-17T10:32:48.000Z 1970-02-05T01:59:58.766Z
DITP DITP
Connexxion 2026-01-17T10:32:49.000Z 1970-02-05T01:59:57.766Z
CXX Connexxion
GVB Metro 2026-01-17T10:32:47.959Z 1970-02-05T01:59:58.807Z
GVB:METRO GVB Metro
TESO TESO
WSF Westerschelde Ferry
Arriva Trein 2026-01-17T10:32:44.000Z 1970-02-05T02:00:02.766Z
ARR:TREIN Arriva Trein
Blue Amigo 2026-01-17T10:32:43.000Z 1970-02-05T02:00:03.766Z
BLUEAMIGO Blue Amigo
DOEKSEN Rederij Doeksen
Keolis 2026-01-17T10:32:46.145Z 1970-02-05T02:00:00.621Z
KEOLIS Keolis
Qbuzz 2026-01-17T10:32:47.000Z 1970-02-05T01:59:59.766Z
QBUZZ Qbuzz
GVB Bus 2026-01-17T10:32:49.218Z 1970-02-05T01:59:57.548Z
GVB GVB Bus
TEC 2026-01-17T10:32:35.000Z 1970-02-05T02:00:11.766Z
TEC TEC
EBS 2026-01-17T10:32:48.000Z 1970-02-05T01:59:58.766Z
EBS EBS
De Lijn 2026-01-17T10:32:29.000Z 1970-02-05T02:00:17.766Z
DELIJN De Lijn
RET Metro 2026-01-17T10:32:48.863Z 1970-02-05T01:59:57.903Z
RET:METRO RET Metro
file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/vite-ssg/dist/shared/vite-ssg.0i5mAeat.mjs:1358
        throw new Error(`${gray("[vite-ssg]")} ${red(`Error on page: ${cyan(route)}`)}
              ^

Error: [vite-ssg] Error on page: /
TypeError: Cannot redefine property: nodeName
    at Object.defineProperties (<anonymous>)
    at extendElement (file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/beasties/dist/index.mjs:224:10)
    at createDocument (file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/beasties/dist/index.mjs:205:3)
    at Beasties.process (file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/beasties/dist/index.mjs:527:22)
    at file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/vite-ssg/dist/shared/vite-ssg.0i5mAeat.mjs:1345:40
    at async file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/vite-ssg/dist/shared/vite-ssg.0i5mAeat.mjs:817:36
    at file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/vite-ssg/dist/shared/vite-ssg.0i5mAeat.mjs:1358:15
    at async file:///C:/Users/Emma/Documents/GitHub/ndov-website/node_modules/vite-ssg/dist/shared/vite-ssg.0i5mAeat.mjs:817:36

Node.js v25.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions