question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dynamicImport is not defined

See original GitHub issue

Currently my build are broken because of this error:

16:42:04.525 | ReferenceError: dynamicImport is not defined
-- | --
16:42:04.525 | at Object.module.exports [as default] (/vercel/bde74988fa2cf27a/.build-utils/.builder/node_modules/jiti/lib/index.js:8:12)
16:42:04.525 | at getNuxtConfig (/vercel/bde74988fa2cf27a/.build-utils/.builder/node_modules/@nuxtjs/vercel-builder/lib/index.js:133:40)
16:42:04.525 | at Object.build (/vercel/bde74988fa2cf27a/.build-utils/.builder/node_modules/@nuxtjs/vercel-builder/lib/index.js:337:26)
16:42:04.525 | at processTicksAndRejections (internal/process/task_queues.js:95:5)
16:42:04.525 | at buildStep (/var/task/webpack:/@vercel/api/scripts/build-container/src/utils/purpose-build.ts:161:1)

was there a new release today?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
unrcommented, Sep 29, 2021

Vercel support (not nuxt) fixed this for us by also suggesting we remove ^ from our package.json

Majority of our packages were added as "package-name": "^1.2.3"

They suggested removing it, and leaving "package-name": "1.2.3" – which also seems to fix our deploys on v0.22.1

This also worked, and is likely the better option for fixing this issue.


FYI @podlebar

1reaction
unrcommented, Sep 29, 2021

I’m still using a vercel.json file, where I can specify builders.

	"builds": [
		{
			"src": "nuxt.config.js",
			"use": "@nuxtjs/vercel-builder@v0.21.3",
			"config": {
				"serverFiles": ["static/robots.txt"]
			}
		}
	],

In my vercel.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the dynamic import() function on Node.js - Stack Overflow
The dynamic import() loads the module and return a module object that contains all its exports. In order to access the default export...
Read more >
Dynamic import module is not defined error with Webpack5
The development mode ( npm run dev ) build errors because module is not defined in a dynamically imported file.
Read more >
import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >
How to Dynamically Import ECMAScript Modules
You can import modules dynamically if you use import as a function — import(pathToModule) — a feature available starting ES2020.
Read more >
Dynamic imports - The Modern JavaScript Tutorial
First, we can't dynamically generate any parameters of import . The module path must be a primitive string, can't be a function call....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found