fisx-hook-amd
v0.2.4
Published
The hook to compile amd modules for fisx.
Downloads
4
Readme
fisx-hook-amd
A hook to compile amd modules for fisx.
How to use
The hook is default installed by fisx.
Add configure to fis-conf.js
fis.hook('amd', {
config: {
baseUrl: 'src'
}
});
Options
ignore -
Array|Function
:optional
configure the files to ignore compile, the array value can beglob
pattern orregexp
. You also can pass a function to determin whether ignore:{ ignore: function (modulePath) { // if wanna ignore, return true } } // you can aslo using file attribute `ignoreAMD` to ignore some specified files. fis.match('dep/jquery/jquery.min.js', { ignoreAMD: true });
config -
Object
: the AMD modulerequire.config
definition, by default the configuration is defined inpackage.json
, so you can pass the configure like beblow:{ config: fis.getModuleConfig() }
externals -
Array
: specify the external module ids:{ externals: [ 'jquery', /vue\-hot\-reload\-api$/ ] } // the AMD require shim config { shim: { jquery: { exports: '$' } } }
dynamic -
Array
: specify the dynamic generated module ids while compiling:{ dynamic: [ 'babelHelpers' ] }
extNames -
Array
: specify the amd module extension names, by default:['.js', '.vue']
:{ extNames: [ '.js', '.vue' ] }
parseScript -
Function
:optional
parsing page amd modules, the option is used when the page is not standard html file, e.g., smarty template file:{ parseScript: function (content, info) { if (!info.isInline) { return; } // parse the inline script in page file return { asynDeps: fis.util.extractAsyncModuleIds(content) }; } }