Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: automatically externalize titanium modules
- Loading branch information
1 parent
b0cd689
commit d4ccb82
Showing
3 changed files
with
37 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
const ExternalsPlugin = require('webpack/lib/ExternalsPlugin'); | ||
|
||
class TitaniumExternalsPlugin { | ||
constructor(modules) { | ||
this.modules = modules; | ||
} | ||
|
||
apply(compiler) { | ||
const externals = [ | ||
'./app.js', | ||
'com.appcelerator.aca', | ||
...this.modules | ||
]; | ||
new ExternalsPlugin('commonjs', externals).apply(compiler); | ||
} | ||
} | ||
|
||
module.exports = TitaniumExternalsPlugin; |