underreact icon indicating copy to clipboard operation
underreact copied to clipboard

108 exclude list

Open samanpwbb opened this issue 5 years ago • 4 comments

This is a more abstracted fix for #108, an alternative to https://github.com/mapbox/underreact/pull/109. Here, user may provide an excludeCompileNodeModules option as an alternative to compileNodeModules, in order to exclude specific modules. By default, GL JS 2+ gets placed in the excludeList. Needs tests and docs.

samanpwbb avatar Jan 05 '21 01:01 samanpwbb

Okay, this is now working. @kepta could you give this a look and lmk if the concept seems okay? If so I'll wrap up tests and docs.

samanpwbb avatar Jan 05 '21 03:01 samanpwbb

It would be better to update readme to tell users that compileNodeModules and excludeCompileNodeModules are mutually exclusive, we can not set both。

jingsam avatar Jan 05 '21 06:01 jingsam

One idea that could prevent the need for mutually exclusive configuration properties: make a breaking change to the compileNodeModules API to make its value an object that allows for more complex choices. I'd say this situation shows that the current interface is probably too limited; an object is nicely extensible.

For example, with an object you could do something like this:

compileNodeModules: { include: ['*'], exclude: ['mapbox-gl'] }

compileNodeModules: { exclude: ['mapbox-gl'] } // many * is the default include: value

One other opinion if you're still brainstorming: I'm wondering if the complexity of trying to distinguish the GL JS version is more trouble than it's worth, since the underreact user should be aware of their GL JS version and can decide to compile or not compile based on that.

davidtheclark avatar Jan 06 '21 20:01 davidtheclark

I suggest just mapping includeCompileNodeModules and excludeCompileNodeModules options to webpack rule.include and rule.exclude. No more hack. Less code, less bug, and less burden.

jingsam avatar Jan 13 '21 06:01 jingsam