1.0.0 • Published 6 years ago

webpack-openmct-plugin v1.0.0

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

webpack-openmct-plugin

Usage

Together with webpack-html-plugin get an openmct project up and running faster than a spaceX launch!

Installation

$ npm install webpack-openmct-plugin --save-dev

Example

Imagine you've just made a HelloPlugin using webpack, and you want to add some default plugins included in openmct

webpack.config.js
  plugins: [
    new OpenMCTPlugin({
      plugins: ['LocalStorage', 'Espresso', 'MyItems']
    }),
    new HtmlWebpackPlugin({  
      template: 'index.html',
      inject: 'head'
    })
  ]
index.html
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <script>openmct.install(new HelloPlugin.default());</script>
  </body>
</html>

If you want to run OpenMCT without any plugins you've made, you can omit the index.html and just run, and everything is set up!

  plugins: [
    new OpenMCTPlugin({
      plugins: ['LocalStorage', 'Espresso', 'MyItems']
    }),
    new HtmlWebpackPlugin()
  ]

Options

  new OpenMCTPlugin({
      plugins: [...],
      openMCTPath: "path/to/openmct",
      // similar to reactDOM, we need something to render to
      binding: "document.addEventListener('DOMContentLoaded', openmct.start.bind(openmct, document.body)"

    })
1.0.0

6 years ago