openlayers / openlayers/ol-rollup

Build error when import "ol/source/GeoTIFF"

Open
#43 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
9
Forks
12
Avg merge
13m
Merged PRs (30d)
3

Description

Hello!

Faced with the problem that when importing a component from "ol/source/GeoTIFF", it is not possible to build.

(!) Missing shims for Node.js built-ins
Creating a browser bundle that depends on "http", "https", "url", "events", "os", "path", "tty"and "util". You might need to include https://github.com/snowpackjs/rollup-plugin-polyfill-node
(!) Missing global variable names
Use output.globals to specify browser global variable names corresponding to external modules
http (guessing 'http')
https (guessing 'https')
url (guessing 'require$$4')
events (guessing 'require$$1$2')
os (guessing 'require$$2')
path (guessing 'require$$0')
child_process (guessing 'require$$1$1')
tty (guessing 'require$$0$1')
util (guessing 'require$$1$3')
(!) Use of eval is strongly discouraged
...

I made a fork with a demonstration of this error:

https://github.com/rendrom/ol-rollup

Run on codesandbox:

https://githubbox.com/rendrom/ol-rollup

For example, the code from the official examples was used:

https://openlayers.org/en/latest/examples/cog.html

To build openlayers legacy, webpack is used with the following settings:

https://github.com/openlayers/openlayers/blob/main/config/webpack-config-legacy-build.mjs#L30-L34

Please advise how to fix the config for building openlayers in rollup with a "ol/source/GeoTIFF" module

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked ol-rollup reproduction and the import of ol/source/GeoTIFF, then compare its Rollup setup with the referenced OpenLayers legacy webpack configuration. Reproduce the browser build and identify the configuration or dependency behavior causing the Node.js built-in warnings; done means the GeoTIFF example builds successfully without those errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rollup
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.