0.2.4 • Published 7 years ago

fisx-hook-amd v0.2.4

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

fisx-hook-amd

Dependency Status devDependency Status NPM Version

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 be glob pattern or regexp. 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 module require.config definition, by default the configuration is defined in package.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)
             };
         }
    }
0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

8 years ago