https://omnifood-nikhilverma.netlify.app/
I got a “The target environment doesn’t support dynamic import() syntax so it’s not possible to use external type ‘module’ within a script” error when running npm run build.
What does this error mean? And how can I fix it? (deploy log attached below)
9:21:57 AM: Netlify Build
9:21:57 AM: ────────────────────────────────────────────────────────────────
9:21:57 AM:
9:21:57 AM: ❯ Version
9:21:57 AM: @netlify/build 29.12.1
9:21:57 AM:
9:21:57 AM: ❯ Flags
9:21:57 AM: baseRelDir: true
9:21:57 AM: buildId: 6487e7cdad9457000847d7fd
9:21:57 AM: deployId: 6487e7cdad9457000847d7ff
9:21:57 AM:
9:21:57 AM: ❯ Current directory
9:21:57 AM: /opt/build/repo
9:21:57 AM:
9:21:57 AM: ❯ Config file
9:21:57 AM: No config file was defined: using default values.
9:21:57 AM:
9:21:57 AM: ❯ Context
9:21:57 AM: production
9:21:57 AM:
9:21:57 AM: Build command from Netlify app
9:21:57 AM: ────────────────────────────────────────────────────────────────
9:21:57 AM:
9:21:57 AM: $ npm run build
9:21:57 AM: > omnifood@0.1.0 build
9:21:57 AM: > react-scripts build
9:21:58 AM: Creating an optimized production build...
9:22:01 AM: One of your dependencies, babel-preset-react-app, is importing the
9:22:01 AM: "@babel/plugin-proposal-private-property-in-object" package without
9:22:01 AM: declaring it in its dependencies. This is currently working because
9:22:01 AM: "@babel/plugin-proposal-private-property-in-object" is already in your
9:22:01 AM: node_modules folder for unrelated reasons, but it may break at any time.
9:22:01 AM: babel-preset-react-app is part of the create-react-app project, which
9:22:01 AM: is not maintianed anymore. It is thus unlikely that this bug will
9:22:01 AM: ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
9:22:01 AM: your devDependencies to work around this error. This will make this message
9:22:01 AM: go away.
9:22:03 AM: Failed to compile.
9:22:03 AM:
9:22:03 AM: The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script
9:22:03 AM:
9:22:03 AM: "build.command" failed
9:22:03 AM: ────────────────────────────────────────────────────────────────
9:22:03 AM:
9:22:03 AM: Error message
9:22:03 AM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
9:22:03 AM:
9:22:03 AM: Error location
9:22:03 AM: In Build command from Netlify app:
9:22:03 AM: npm run build
9:22:03 AM:
9:22:03 AM: Resolved config
9:22:03 AM: build:
9:22:03 AM: command: npm run build
9:22:03 AM: commandOrigin: ui
9:22:03 AM: publish: /opt/build/repo/build
9:22:03 AM: publishOrigin: ui
9:22:04 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
9:22:04 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:22:04 AM: Failing build: Failed to build site
9:22:04 AM: Finished processing build request in 22.08s
Repository: