electron-userland / electron-compile

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications
1.01k stars 99 forks source link

Allow compiling some of node_modules dependencies #230

Open mhagmajer opened 7 years ago

mhagmajer commented 7 years ago

We have a couple node dependencies that are published uncompiled. The logic behind it is to allow final projects to compile entire code in slightly different ways.

We're currently manually changing FileChangedCache.isInNodeModules method to return false for specified set of those dependencies.

This part of electron-forge also needs to be changed in order to precompile these dependencies: https://github.com/electron-userland/electron-forge/blob/master/src/util/compile-hook.js#L13

@paulcbetts do you think it would make sense to create an option for this? If so, I'm happy to work on a PR with this. Please also kindly give some pointers on what would be the best way to accomplish that so that such option could be also used with electron-prebuilt-compile

anaisbetts commented 7 years ago

@mhagmajer What reason do you have to ship precompiled source files? I'm trying to understand the scenario here

mhagmajer commented 7 years ago

@paulcbetts, thanks for taking time to reply!

There is a couple of reasons:

We could use git modules for all this, but we prefer to do npm install directly from GitHub, since we already use npm for handling other dependencies. This would be an opt-in mechanism so there would be no performance impact for users who only depend on precompiled libraries.

leungwensen commented 7 years ago

@paulcbetts my use case is, my project is so sensitive to the final bundle size that I have to enable tree shaking for building. So, sometimes I want to import source files of the depended modules directly like this: import vec2 from 'gl-matrix/src/gl-matrix/vec2'