node-emoji icon indicating copy to clipboard operation
node-emoji copied to clipboard

🐛 Bug: Build error

Open Revadike opened this issue 2 years ago • 1 comments

The overhaul since v2.1.1 causes the following build error for our nuxt2 app (using node v18):

Entrypoint app = 0b2fe6a.js 483a9b5.js fa73801.js 7bcbdff.js

ERROR in ./node_modules/node-emoji/lib/index.js 74:33
Module parse failed: Unexpected token (74:33)
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
| // src/find.ts
| var find = (codeOrName) => {
>   return findByCode(codeOrName) ?? findByName(codeOrName);
| };
| 
 @ ./components/SEmojiSelector.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/SEmojiSelector.vue?vue&type=script&lang=js) 2:0-36 32:22-34
 @ ./components/SEmojiSelector.vue?vue&type=script&lang=js
 @ ./components/SEmojiSelector.vue
 @ ./components/Input/ChatMessage.vue
 @ ./node_modules/.cache/nuxt/components/index.js
 @ ./node_modules/.cache/nuxt/components/plugin.js
 @ ./node_modules/.cache/nuxt/index.js
 @ ./node_modules/.cache/nuxt/client.js
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/.cache/nuxt/client.js

 FATAL  Nuxt build error                                                                                                                                                                                                                                                                                              11:08:33  

  at WebpackBundler.webpackCompile (node_modules\@nuxt\webpack\dist\webpack.js:1868:21)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async WebpackBundler.build (node_modules\@nuxt\webpack\dist\webpack.js:1833:5)
  at async Builder.build (node_modules\@nuxt\builder\dist\builder.js:249:5)
  at async ensureBuild (node_modules\@nuxt\cli\dist\cli-generate.js:117:3)
  at async Object.run (node_modules\@nuxt\cli\dist\cli-generate.js:234:7)
  at async NuxtCommand.run (node_modules\@nuxt\cli\dist\cli-index.js:356:7)


   ╭─────────────────────────────╮
   │                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯

error Command failed with exit code 1.

  "engines": {
    "node": "18"
  },
  "imports": {
    "#src/*": "./src/*.js"
  },
  "dependencies": {
    "@braintree/sanitize-url": "^6.0.4",
    "@nuxtjs/dayjs": "^1.4.1",
    "@nuxtjs/firebase": "^8.2.2",
    "@nuxtjs/pwa": "^3.3.5",
    "@nuxtjs/recaptcha": "^1.1.2",
    "@tiptap/core": "~2.1.12",
    "@tiptap/extension-blockquote": "~2.1.7",
    "@tiptap/extension-bold": "~2.1.12",
    "@tiptap/extension-bullet-list": "~2.1.12",
    "@tiptap/extension-color": "~2.1.12",
    "@tiptap/extension-document": "~2.1.12",
    "@tiptap/extension-hard-break": "~2.1.12",
    "@tiptap/extension-history": "~2.1.12",
    "@tiptap/extension-horizontal-rule": "~2.1.12",
    "@tiptap/extension-italic": "~2.1.12",
    "@tiptap/extension-link": "~2.1.12",
    "@tiptap/extension-list-item": "~2.1.12",
    "@tiptap/extension-mention": "^2.1.12",
    "@tiptap/extension-ordered-list": "~2.1.12",
    "@tiptap/extension-paragraph": "~2.1.12",
    "@tiptap/extension-subscript": "~2.1.12",
    "@tiptap/extension-superscript": "~2.1.12",
    "@tiptap/extension-table": "~2.1.12",
    "@tiptap/extension-table-cell": "~2.1.12",
    "@tiptap/extension-table-header": "~2.1.12",
    "@tiptap/extension-table-row": "~2.1.12",
    "@tiptap/extension-text": "~2.1.12",
    "@tiptap/extension-text-align": "~2.1.12",
    "@tiptap/extension-text-style": "~2.1.12",
    "@tiptap/extension-underline": "~2.1.12",
    "@tiptap/pm": "~2.1.12",
    "@tiptap/suggestion": "^2.1.12",
    "@tiptap/vue-2": "~2.1.12",
    "algoliasearch": "^4.19.1",
    "axios": "^1.6.2",
    "buffer": "^6.0.3",
    "cropperjs": "^1.6.0",
    "crypto-browserify": "^3.12.0",
    "dayjs": "^1.11.10",
    "filesize": "^9.0.11",
    "firebase": "^10.7.0",
    "firebase-admin": "^11.11.1",
    "get-youtube-id": "^1.0.1",
    "html2canvas": "^1.4.1",
    "linkify-string": "^4.1.3",
    "linkifyjs": "^4.1.3",
    "lodash": "^4.17.21",
    "lru-cache": "^7.18.3",
    "node-emoji": "2.1.0",
    "nuxt": "^2.17.1",
    "photoswipe": "^4.1.3",
    "qrcode": "^1.5.3",
    "randombytes": "^2.1.0",
    "slugify": "^1.6.6",
    "thirty-two": "^1.0.2",
    "tippy.js": "^6.3.7",
    "vue": "2.7.15",
    "vue-agile-lite": "^1.0.4",
    "vue-server-renderer": "2.7.15",
    "vue-template-compiler": "2.7.15",
    "vuedraggable": "^2.24.3",
    "vuetify": "^2.7.1",
    "vuex": "^3.6.2"
  },
  "devDependencies": {
    "@babel/eslint-parser": "^7.23.3",
    "@nuxt/types": "^2.17.2",
    "@nuxtjs/eslint-config": "^12.0.0",
    "@nuxtjs/eslint-module": "^3.1.0",
    "@nuxtjs/vuetify": "^1.12.3",
    "cli-progress": "^3.12.0",
    "dotenv": "^16.3.1",
    "eslint": "^8.54.0",
    "eslint-plugin-nuxt": "^4.0.0",
    "eslint-plugin-vue": "^9.19.2",
    "firebase-tools": "^12.9.1",
    "html-to-vue": "^1.4.0",
    "i18n-iso-countries": "^7.6.0",
    "inquirer": "^9.2.12",
    "minify-css-string": "^1.0.0",
    "nuxt-vite": "^0.3.5",
    "postcss-preset-env": "^9.1.2",
    "sharp": "^0.32.5",
    "sywac": "^1.3.0",
    "unplugin-vue-components": "^0.25.2",
    "utf8": "^3.0.0"
  },
  "browser": {
    "crypto": false
  }

Revadike avatar Dec 01 '23 22:12 Revadike

Thanks for filing the issue! Is there any way you can share your project, or a way for us to reproduce your issue on our end? Just seeing the error and file contents really isn't enough to fully diagnose what's going on.

ERROR in ./node_modules/node-emoji/lib/index.js 74:33
Module parse failed: Unexpected token (74:33)
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
| // src/find.ts
| var find = (codeOrName) => {
>   return findByCode(codeOrName) ?? findByName(codeOrName);
| };
| 
 @ ./components/SEmojiSelector.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/SEmojiSelector.vue?vue&type=script&lang=js) 2:0-36 32:22-34

We can infer from the error and call stack that the issue is probably something like:

  • You're using Babel with Webpack
  • The Babel loader isn't configured to be able to load newer JS syntax such as ??

JoshuaKGoldberg avatar Dec 01 '23 23:12 JoshuaKGoldberg

👋 ping @Revadike, is this still something you have energy and time for?

JoshuaKGoldberg avatar Mar 05 '24 17:03 JoshuaKGoldberg

what is this

Revadike avatar Mar 05 '24 17:03 Revadike

...you tell me, you filed it 😄

JoshuaKGoldberg avatar Mar 05 '24 18:03 JoshuaKGoldberg

We couldn't use the latest version iirc It would not load/import

Revadike avatar Mar 05 '24 18:03 Revadike

Ok. If you have answers to https://github.com/omnidan/node-emoji/issues/162#issuecomment-1836938393, please do post them here - otherwise there's nothing we can help you with.

Closing out as non-actionable. Cheers!

JoshuaKGoldberg avatar Mar 05 '24 18:03 JoshuaKGoldberg