NativeScript / nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
Apache License 2.0
97 stars 49 forks source link

Allow custom platform plugins to mix with NativeScript core modules #1122

Open bundyo opened 4 years ago

bundyo commented 4 years ago

Is your feature request related to a problem? Please describe. Currently NativeScript doesn't support other platforms than iOS and Android. In order to make this possible, we need to somehow redirect the custom platforms to external plugins.

Describe the solution you'd like An env.platform option in dev-webpack that will allow specifying the name of the external platform and dev-webpack to load its files from there. In order for the platform to be able to access the {N} core modules, we need somehow to "mix" the plugin and the core modules files, in order for core modules to find the needed platform files. This can be done through specifying a separate bundle-entry-points file inside the plugin in order to list less or more module entry points and the the dev-webpack file system plugin to redirect the external platform files to the external plugin. Then Webpack can be started with:

npx webpack --env.platform desktop --watch

(this means no CLI support for external platforms for now, as this calls for more extensive planning).

Describe alternatives you've considered Adding new platforms inside core modules, but this requires core modules to be forked and updates become a bit of a problem.

Additional context I'm planning on creating a two external platforms from the PoC projects I've created in the past - Web and Desktop.