OpenLightingProject / open-fixture-library

A library and website for lighting technology's DMX fixture definition files.
https://open-fixture-library.org/
MIT License
193 stars 64 forks source link

Nuxt build error on Windows 11 #4218

Closed p-rogalski closed 1 month ago

p-rogalski commented 1 month ago

Steps to reproduce

  1. Follow installation instructions
  2. Checkout master branch
  3. npm install
  4. npm run build <-- The error occurs here

Error message

ERROR in ./node_modules/a11y-dialog/dist/a11y-dialog.esm.js 141:22
Module parse failed: Unexpected token (141:22)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     // The browser acts as as if there is only one focusable element – the shadow
|     // button. Our library should behave the same way.
>     if (el.shadowRoot?.delegatesFocus)
|         return false;
|     return el.matches(focusableSelectors.join(',')) && !isHidden(el);
 @ ./ui/components/A11yDialog.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./ui/components/A11yDialog.vue?vue&type=script&lang=js) 43:19-40
 @ ./ui/components/A11yDialog.vue?vue&type=script&lang=js
 @ ./ui/components/A11yDialog.vue
 @ ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./ui/components/HelpWantedDialog.vue?vue&type=script&lang=js
 @ ./ui/components/HelpWantedDialog.vue?vue&type=script&lang=js
 @ ./ui/components/HelpWantedDialog.vue
 @ ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./ui/pages/_manufacturerKey/_fixtureKey.vue?vue&type=script&lang=js
 @ ./ui/pages/_manufacturerKey/_fixtureKey.vue?vue&type=script&lang=js
 @ ./ui/pages/_manufacturerKey/_fixtureKey.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

 FATAL  Nuxt build error                                                                                                                                                    20:14:34  

  at WebpackBundler.webpackCompile (node_modules\@nuxt\webpack\dist\webpack.js:1888:21)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async WebpackBundler.build (node_modules\@nuxt\webpack\dist\webpack.js:1853:5)
  at async Builder.build (node_modules\@nuxt\builder\dist\builder.js:249:5)
  at async Object.run (node_modules\@nuxt\cli\dist\cli-build.js:99:7)
  at async NuxtCommand.run (node_modules\@nuxt\cli\dist\cli-index.js:356:7)

   ╭─────────────────────────────╮
   │                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯
FloEdelmann commented 1 month ago

What is your Node.js version? (Run node -v.)

p-rogalski commented 1 month ago

What is your Node.js version? (Run node -v.)

v20.17.0

FloEdelmann commented 1 month ago

Hmm, strange. It seems to get tripped up with the optional chaining operator (?.), which should be supported by at least Node v18+. I can build without problems on Linux, so I'm not sure how I can help you here :/

FloEdelmann commented 1 month ago

@Firionus added the Windows installation instructions, maybe they can help?

p-rogalski commented 1 month ago

https://github.com/OpenLightingProject/open-fixture-library/blob/a123cfe7019ab768edc093a99a4aaf9c92e6963f/nuxt.config.js#L81-L89

Maybe the exclude does not work on Windows?

FloEdelmann commented 1 month ago

Ahh, I forgot about that one. Yeah, probably the path needs to use \ for Windows. Could you try changing the regex to /node_modules[\/\\]a11y-dialog/?

p-rogalski commented 1 month ago

Nice, that works like a charm! I'm gonna open a PR right away.