1.2.1 • Published 4 months ago

rollup-plugin-mediawiki-gadget v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

rollup-plugin-mediawiki-gadget

Roll up MediaWiki gadgets with modern goodies.

This plugin provides support for integrating Rollup with external packages from MediaWiki ResourceLoader.

Usage

.gadgetdefinition:

* my-gadget [ ResourceLoader | package | dependencies=user.options ] | my-gadget.js | my-gadget-main.js | my-gadget-AppComponent.js

rollup.config.js:

import mwGadget from 'rollup-plugin-mediawiki-gadgets';

export default {
  output:{
    // Or 'iife' for a single bundle
    format: 'cjs',

    // By default the generated code uses arrow functions for smaller code size
    // Set this if you need ECMAScript 5 compatibility
    generatedCode: 'es5',
  },
  plugins: [
    mwGadget({
      // Note that the gadget must be ResourceLoader compatible
      gadgetDef: '.gadgetdefinition',

      // Additional dependencies to load conditionally using import()
      // It will be transpiled to mw.loader.using calls on the fly
      softDependencies: ['vue', '@wikimedia/codex'],
    })
  ]
};

Vite Compatibility

To use with Vite you need to specify enforce: 'pre'.

vite.config.js:

export default {
  plugins: [
    {
      ...mwGadget(/* ... */),
      enforce: 'pre'
    }
  ]
};
1.2.1

4 months ago

1.2.0

6 months ago

1.1.0

7 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

0.0.1

11 months ago