Skip to content

motorcycle/loader

Repository files navigation

@motorcycle/loader

This loader makes use of @motorcycle/compiler to make compile-time optimizations of Motorcycle constructs.

Install

yarn add --dev @motorcycle/loader
# or
npm install --save-dev @motorcycle/loader

Motorcycle Starter

This loader and other webpack optimizations are configured for you in our very own Motorcycle starter application, which can be found here.

Usage

To make use of this loader you only need to add @motorcycle/loader before ts-loader in your webpack configuration with some configuration.

// webpack.config.js
const entry = 'src/bootstrap.ts'

module.exports = {
  entry,
  module: {
    rules: [
      {
        test: /\.ts$/,
        use: [
          {
            loader: '@motorcycle/loader',
            options: {
              entries: [ entry ]
            }
          },
          'ts-loader'
        ],
        exclude: /node_modules/
      }
    ]
  },
  // other configuration options
}

Options

entries: Array<string>

Entries are paths, relative or absolute, to the part(s) of your application that have calls to run from @motorcycle/run.