Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while deployment #28

Open
SoleDad402 opened this issue Jul 26, 2024 · 1 comment
Open

Issue while deployment #28

SoleDad402 opened this issue Jul 26, 2024 · 1 comment

Comments

@SoleDad402
Copy link

I'm developing GIS application using openlayer, and I have implemented rotation controller using ol-rotate-feature.
But below issues occur while 'npm run build'.
What should I do?

info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
✓ Linting and checking validity of types
▲ Next.js 14.0.2

  • Environments: .env.local

Failed to compile.

./node_modules/ol-rotate-feature/dist/ol-rotate-feature.umd.js
Module not found: ESM packages (ol/interaction) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/components/Map/Interactions.tsx
./src/pages/map-index.tsx

./node_modules/ol-rotate-feature/dist/ol-rotate-feature.umd.js
Module not found: ESM packages (ol) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/components/Map/Interactions.tsx
./src/pages/map-index.tsx

./node_modules/ol-rotate-feature/dist/ol-rotate-feature.umd.js
Module not found: ESM packages (ol/layer) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/components/Map/Interactions.tsx
./src/pages/map-index.tsx

./node_modules/ol-rotate-feature/dist/ol-rotate-feature.umd.js
Module not found: ESM packages (ol/source/Vector) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/components/Map/Interactions.tsx
./src/pages/map-index.tsx

./node_modules/ol-rotate-feature/dist/ol-rotate-feature.umd.js
Module not found: ESM packages (ol/geom) need to be imported. Use 'import' to reference the package instead. https://nextjs.org/docs/messages/import-esm-externals

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/components/Map/Interactions.tsx
./src/pages/map-index.tsx

image

@ghettovoice
Copy link
Owner

Hello @SoleDad402 ,
as I see, your builder trying to include UMD version of the ol-rotate-feature, that is nowadays correctly works only in browser with <script> tag.
So, you need to force the builder to use ESM version from ol-rotate-feature/dist/ol-rotate-feature.esm.js.

I'm not and expert with nextjs, that is what I have found about this. Try to use this option:

// next.config.js
module.exports = {
  // Prefer loading of ES Modules over CommonJS
  experimental: { esmExternals: true }
}

or this

// next.config.js
module.exports = {
  experimental: { esmExternals: 'loose' }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants