This loader makes use of @motorcycle/compiler
to
make compile-time optimizations of Motorcycle constructs.
yarn add --dev @motorcycle/loader
# or
npm install --save-dev @motorcycle/loader
This loader and other webpack optimizations are configured for you in our very own Motorcycle starter application, which can be found here.
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
}
Entries are paths, relative or absolute, to the part(s) of your application that
have calls to run
from @motorcycle/run
.